Jscrollpane:水平滚动条可以实现滚动200px的功能吗?
我尝试像垂直示例中那样进行操作,但无法使其工作。
所以我有一个 div,里面有一个水平滚动条,里面有很多图片。 我现在想做一个按钮,如果单击该按钮将滚动 +200px 或类似的东西。 这可能吗?我从哪里开始?在谷歌或这里找不到任何东西......
I tried doing it like in the vertical example but could not get that to work.
So what I have is a div with a horizontal scrollbar in it with a lot of pictures in it.
I now want to make a button that if clicked will scroll +200px or something like that.
Is this possible and where do I start? Couldn't find anything on google or here...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
听起来您正在寻找jScrollPane 2的scrollBy功能:
http://jscrollpane.kelvinluck.com/scroll_to .html
由于您只想水平滚动,因此将使用 scrollByX 函数像这样:
此外,您提到您的滚动窗格包含大量图像。如果是这种情况,您需要确保滚动窗格可以使用以下两种技术之一正确计算其宽度:
http://jscrollpane.kelvinluck.com/image2.html
http://jscrollpane. kelvinluck.com/image.html
It sounds like you are looking for the scrollBy functionality of jScrollPane 2:
http://jscrollpane.kelvinluck.com/scroll_to.html
Since you only want to scroll horizontally you will use the scrollByX function like so:
Additionally, you mention that your scrollpane contains lots of images. If this is the case you will need to ensure that the scrollpane can correctly calculate it's width by using one of the following two techniques:
http://jscrollpane.kelvinluck.com/image2.html
http://jscrollpane.kelvinluck.com/image.html
您使用哪个版本?根据文档,此问题不存在,但已在几个月前发布的最新版本中修复...
请参阅 http://code.google.com/p/jscrollpane/issues/detail?id=8
如果这对您不起作用,还有另一个插件< href="http://plugins.jquery.com/project/jscrollhorizontalpane" rel="nofollow">http://plugins.jquery.com/project/jscrollhorizontalpane 可能会为您完成这项工作。
Which version are you using? According to the documentation this did not exist but has been fixed in the latest version, which came out a few months ago...
see http://code.google.com/p/jscrollpane/issues/detail?id=8
If this doesn't work for you, there is another plugin http://plugins.jquery.com/project/jscrollhorizontalpane that may do the job for you.