admin管理员组文章数量:1430143
How can I catch the event of scroll down the page? I mean I want to have function call if the user scroll down to the end of the page?
Using Prototype JS or pure Javascript.
How can I catch the event of scroll down the page? I mean I want to have function call if the user scroll down to the end of the page?
Using Prototype JS or pure Javascript.
Share Improve this question edited Jul 20, 2019 at 18:56 Brian Tompsett - 汤莱恩 5,89372 gold badges61 silver badges133 bronze badges asked May 27, 2011 at 11:57 ehsun7behsun7b 4,86614 gold badges63 silver badges99 bronze badges2 Answers
Reset to default 4You would need to bind a scroll event to the window and then check the scroll position.
$(window).observe('scroll', function(event) {
var scrollOffsets = document.viewport.getScrollOffsets();
var scrollTop = scrollOffsets.top;
});
Using prototypejs try this,
$(document).observe('scroll', function(event) {
alert("the page has been scrolled");
//call the user function
});
or try this,
Event.observe(window,'scroll', function(event) { alert("the page has been scrolled");
//call the user function
});
本文标签: javascriptScroll Down the page eventStack Overflow
版权声明:本文标题:javascript - Scroll Down the page event - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745554350a2663090.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论