📅  最后修改于: 2020-11-26 01:10:11             🧑  作者: Mango
jQuery scrollTop方法用于设置或返回所选元素的垂直滚动条位置。当滚动条位于顶部时,它指定位置0。
句法:
要返回垂直滚动条位置:
$(selector).scrollTop()
Parameter | Description |
---|---|
Position | It specifies the vertical scrollbar position in pixels. |
让我们以一个示例来演示jQuery scrollTop()方法。
Twinkle, twinkle, little star,How I wonder what you are!
Up above the world so high, Like a diamond in the sky.
Twinkle, twinkle, little star, How I wonder what you are!
Move the scrollbar down and click the button again.
scrollTop demo
Welcome to:
javatpoint.com