开发者

Scroll Down the page event

开发者 https://www.devze.com 2023-03-08 23:16 出处:网络
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?

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 Javascr开发者_开发问答ipt.


You 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 
}); 
0

精彩评论

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