开发者

In a div that has overflow:scroll, how do I check what position the scroll is at?

Using JQuery.

How do I know if it's scr开发者_如何学Goolled to the middle? Top? Bottom?


You can use the element's scrollLeft, scrollTop, scrollWidth and scrollHeight properties to find out the status of the element's scrolling.


jQuery will allow you to get scrollTop property like an attribute...

$('element').attr('scrollTop');


scrollTop gets or sets the number of pixels that the content of an element is scrolled upward

MDC Docs

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜