我怎样才能以自己的滚动条以编程方式滚动div? [英] How can I scroll programmatically a div with its own scrollbars?
本文介绍了我怎样才能以自己的滚动条以编程方式滚动div?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个内部DIV用于内容的HTML页面。内部DIV有它自己的滚动条。我想自动滚动到DIV中的某个位置。
我该怎么做? (请注意,我不想自动滚动窗口滚动条 - 我已经知道如何做到这一点)
需要跨平台解决方案
$ b $这个div有一个 scrollTop
属性,你可以设置它(和它的朋友, scrollLeft
)。 - .mzilla.org / en / DOM / element.scrollLeft>
scrollDft
在MDN上 I have a HTML page with an internal DIV used for content. The internal DIV has its own scrollbars. I would like to automatically scroll to a certain position in the DIV.
How can I do this? (Note that I do NOT want to auto scroll the Window scrollbars - I already know how to do this)
A cross platform solution is needed
解决方案
The div has a scrollTop
property that you can set (and its pal, scrollLeft
).
这篇关于我怎样才能以自己的滚动条以编程方式滚动div?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文