jScrollPane:删除滚动条装订线?

发布于 2024-11-15 17:13:50 字数 429 浏览 1 评论 0原文

我希望将滚动条放置在内容上方,而不是在其旁边强制放置一个装订线。

在附图中,您可以看到它当前对红色滚动条的作用...它创建了一个垂直装订线,将内容推到一边。

但我想做的是底部的内容......将滚动条定位在内容上方。

我尝试过绝对定位 .jspVerticalBar 但我无法摆脱排水沟。

在此处输入图像描述

编辑:这是问题的 jsFiddle:http://jsfiddle.net/8Mebt/3/ -- 正如你所看到的,最右边仍然有一个间隙,项目的“选定”状态并没有像我想要的那样一直延伸。

I'd like to have the scrollbar place over the content instead of forcing a gutter beside it.

In the attached image you can see what it currently does with the red scroll bar...it creates a vertical gutter that pushes the content to the side.

But what I want to do is what's on the bottom...have the scrollbar positioned over the content.

I've tried absolutely positioning .jspVerticalBar but I haven't been able to get rid of the gutter.

enter image description here

EDIT: Here's the jsFiddle of the problem: http://jsfiddle.net/8Mebt/3/ -- As you can see, there's still a gap on the far right and the "selected" state of the item doesn't extend all the way over as I want it to.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

╭ゆ眷念 2024-11-22 17:13:50

.jspVerticalBar 已经绝对定位。将其 right 属性设置为您想要的,并设置

.jspHorizontalBar, .jspVerticalBar, .jspTrack {
    background: none repeat scroll 0 0 transparent;
}

为使装订线的背景(在 jscrollpane 中称为轨道)透明。

演示位于 http://jsfiddle.net/gaby/DsDQP/


更新

评论后( 包括a jsfiddle)这是我的解决方法。

verticalGutter 设置设置为 0 并重新计算 jspPane 的宽度以包含 jspTrack 宽度。

$('.scroll-pane').jScrollPane({verticalGutter:0});
$('.jspPane').css({width:'+=' + $('.jspTrack').width()});

演示位于 < a href="http://jsfiddle.net/gaby/DsDQP/8/" rel="nofollow">http://jsfiddle.net/gaby/DsDQP/8/

每次重新初始化后都需要调用重新计算..

这是必需的,因为 jspPane 的宽度(内容)是通过 javascript 通过计算容器宽度并删除 verticalGutter添加的。 jspTrack 宽度。您也可以使用 CSS 重新定义宽度,并使用 !important 指令覆盖通过 javascript 添加的宽度,如评论中提到的 @Evgeny

The .jspVerticalBar is already absolutely positioned. Set its right property to what you want, and also set

.jspHorizontalBar, .jspVerticalBar, .jspTrack {
    background: none repeat scroll 0 0 transparent;
}

so that the background of the gutter (track as is it called in jscrollpane) is transparent..

Demo at http://jsfiddle.net/gaby/DsDQP/


Update

After the comments (including a jsfiddle) here is my workaround..

Set the verticalGutter setting to 0 and recalculate the width of the jspPane to include the jspTrack width..

$('.scroll-pane').jScrollPane({verticalGutter:0});
$('.jspPane').css({width:'+=' + $('.jspTrack').width()});

demo at http://jsfiddle.net/gaby/DsDQP/8/

The recalculation needs to be called after each reinitialization..

This is needed because the width of the jspPane (the content) is being added through javascript by calculating the container width and removing the verticalGutter and the .jspTrack width. You can alternatively redefine the width with CSS and use the !important directive to override the width added through javascript as @Evgeny mentions in the comments.

宁愿没拥抱 2024-11-22 17:13:50

您可以在 jScrollPane 初始化时设置一个负的 verticalGutter 值,它就会完成任务,无需其他操作。

$('.scroll-pane').jScrollPane({verticalGutter:-100})

http://jsfiddle.net/DsDQP/50/

You can put a negative verticalGutter value at the jScrollPane initialization and it will do the trick, with no additional actions required.

$('.scroll-pane').jScrollPane({verticalGutter:-100})

http://jsfiddle.net/DsDQP/50/

哆啦不做梦 2024-11-22 17:13:50

您可以尝试这样做......

    //Should it (the #parentContainer) have had a "scroll-pane" class

        $('#parentContainer').jScrollPane()

    $.each(data, function(i, value) {

//Detach scrolling capabilities
        $('#parentContainer').jScrollPaneRemove();

        $('<div/>',{
        class:'anyClass',
        id:'anyId'
        })
        .appendTo(#childContainer);

//Return back Scrolling capabilities to the parent container    
        $('#parentContainer').jScrollPane();            


        ///-> Loop Ends
                });

这样,每次循环时都会更新滚动功能......因此 ScrollBar 的长度将根据子容器中数据存储的大小而增加或缩小。

希望有帮助......

埃贝斯特

You can try to do it this way.....

    //Should it (the #parentContainer) have had a "scroll-pane" class

        $('#parentContainer').jScrollPane()

    $.each(data, function(i, value) {

//Detach scrolling capabilities
        $('#parentContainer').jScrollPaneRemove();

        $('<div/>',{
        class:'anyClass',
        id:'anyId'
        })
        .appendTo(#childContainer);

//Return back Scrolling capabilities to the parent container    
        $('#parentContainer').jScrollPane();            


        ///-> Loop Ends
                });

With this, the scrolling capabilities are renewed every time a loop is made....hence the ScrollBar's length will grow or shrink depending on the size of data store in the child container.

Hope that helps....

Ebest

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文