如何使用 jScrollPane 使自定义滚动条始终可见?
我有使用 jQuery 的 jScrollPane 插件的滚动条。
滚动条有效,所有内容均使用 AJAX,因此对于每个“页面”加载,我都会添加滚动条的重新初始化。 但是当内容比页面短时,滚动条不可见。
这会导致内容有 10px 的额外空间,这对于使用 100% 可用空间的项目来说很烦人。
有人知道如何在内容不可用时使滚动条可见吗? 或者使用替代的 CSS 方式来保留空间也可以。
I have scrollbars using the jScrollPane plug-in for jQuery.
The scrollbar works, all content is with AJAX, so for every 'page' load, I add the re-initialization of the scrollbars.
But when content is shorter than the page, the scrollbars are not visible.
This results in 10px extra space for the content, and that is annoying with items using 100% of the available space.
Anyone an idea how to make the scrollbars visible even when content is not available?
Or an alternative CSS way to reserve the space is also fine.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果没有人找到更好的解决方案,
我已经可以说我修改了 jScrollPane 插件,以始终显示“轨道”栏,如果它要隐藏滚动条(因为内容小于视图),我也不会附加 '拖动'栏。虽然它不是一个非常干净的选择。
应该进一步采取措施,并禁用/重新启用向上向下按钮,添加 css 功能,以便在禁用时不执行悬停/活动状态...以获得更好的可用性。
仍然期待一个可能的更好的解决方案,尽管我觉得我会想出唯一可能的解决方案,因为可能没有开箱即用的解决方案
If nobody finds a better solution,
i can already say that i modified jScrollPane plugin, to always show the "track" bar, and if it was going to hide the scrollbar (because content was smaller than the view) i also not append the 'drag' bar. though its not a very clean option.
it should be taken further, and also disable / re-enable the up down buttons, adding css functionality not to do hover/active state's when its disabled... for better usability.
still looking forward to a possible better solution, though i feel that i will have come up with the only possible solution as there probably is none out of the box
我认为在将此功能添加到 jScrollPane 之前,只有肮脏的技巧可用于解决此问题。我所做的是询问 jScrollPane 是否启用了滚动;如果没有,我添加了一个看起来像空/禁用滚动条的 div。这是代码:
希望这可以帮助某人......
Markus
这是虚拟滚动条的 CSS:
I think until this feature is added to jScrollPane there are only dirty tricks available to fix this. What I did was to ask jScrollPane if scrolling is enabled; if not, I added a div that looks like an empty/disabled scrollbar. This is the code:
Hop this helps someone...
Markus
This is the CSS for the dummy scroll bar: