[英]Javascript : How to scroll horizontally to given position within an overflowed div?
I have following situation 我有以下情况
WRAPPER (100% width of page)
----------------------------------------------
| |
| |
| CONTENT (8000px width) |
| |
| |
----------------------------------------------
| HORIZONTAL SLIDER FOR CONTENT |
----------------------------------------------
Dragging the slider is moving thought the content. 拖动滑块会移动内容。
I would like to ask how can i programatically trigger horizontal slider click to move for give position. 我想问一下我如何以编程方式触发水平滑块单击以移动以给出位置。 Or how move to the given position on axis X.
或者如何移动到X轴上的给定位置。
I tried scrollTo but without the luck (it works only for document object. 我尝试了scrollTo但没有运气(它仅适用于文档对象。
Maybe use the anchors, but i would like the simplest solution. 也许使用锚,但我想要最简单的解决方案。
Many thanks for any advice. 非常感谢您的任何建议。
Did you try with scrollLeft(value)? 您是否尝试过scrollLeft(value)?
For more information on this please see the link https://api.jquery.com/scrollleft/ 有关此的更多信息,请参见链接https://api.jquery.com/scrollleft/
您可以在容器上使用jquery scrollLeft()方法(或scrollLeft DOM属性)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.