javascript 带有 slimscroll 的水平滚动条
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/24571449/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
horizontal scrollbars with slimscroll
提问by wendellmva
I use slimscroll for my scrolling needs and it works great. Now I have need for horizontal scrolling. A quick google search gives me some results to references in the github source code and some issues which indicates that that horizontal scroll support has been added but nowhere I can I find an example. I've looked in the javascript file expecting to find a flag to switch from vertical to horizontal. Helas nothing so obvious. So my question is it possible if yes, how? An example would be greatly appreciated.
我使用 slimscroll 来满足我的滚动需求,而且效果很好。现在我需要水平滚动。一个快速的谷歌搜索给了我一些结果到 github 源代码中的引用和一些问题,表明已经添加了水平滚动支持,但我找不到任何例子。我查看了 javascript 文件,希望找到一个从垂直切换到水平的标志。Helas 没有那么明显。所以我的问题是否有可能,如果是,如何?一个例子将不胜感激。
回答by Gromo
The latest version of slimscroll is 1.3.1 (from github repository) and it does not support horizontal scrollbar. Try jQuery Scrollbaror any scrollbar that supports horizontal scrolling from this scrollbar comparison table.
最新版本的 slimscroll 是 1.3.1(来自 github 存储库),它不支持水平滚动条。尝试使用jQuery Scrollbar或任何支持从该滚动条比较表进行水平滚动的滚动条。
回答by Lucas
Now you can atualize your plug-in on the SlimScroll git repository, and just use the code below to instance your slimScroll
现在您可以在SlimScroll git 存储库中实现您的插件,只需使用下面的代码来实例化您的 slimScroll
$('#testDiv').slimscroll({
height: 150,
width: 300,
axis: 'both'
});
回答by Zaid Bin Khalid
Slimscroll with both axes examples using Bootstrap 4.
使用 Bootstrap 4 的两个轴示例的 Slimscroll。
Click hereto see the online working examples.
单击此处查看在线工作示例。
回答by Jan Kuri
回答by Sarav
Did you try adding this code?
您是否尝试添加此代码?
$(".content").mCustomScrollbar({
axis:"x" // horizontal scrollbar
});
$(".content").mCustomScrollbar({
axis:"yx" // vertical and horizontal scrollbar
});