And once it hits the bottom,then have a callback function?
一旦它到达底部,就会有一个回调函数?
1 个解决方案
#1
25
You can use .scroll() event in this way on your window:
您可以在您的窗口中以这种方式使用.scroll()事件:
$(window).scroll(function() {
if($(window).scrollTop() + $(window).height() == $(document).height()) {
alert("bottom!");
}
});
check live demo
检查现场演示
to detect if the user is 3/4 down the page you can try this one
要检测用户是否在页面的3/4,你可以试试这个。
$(window).scroll(function() {
if($(window).scrollTop() + $(window).height() > $(document).height() - .75*$(document).height()) {
alert("3/4th of bottom!");
}
});
#1
25
You can use .scroll() event in this way on your window:
您可以在您的窗口中以这种方式使用.scroll()事件:
$(window).scroll(function() {
if($(window).scrollTop() + $(window).height() == $(document).height()) {
alert("bottom!");
}
});
check live demo
检查现场演示
to detect if the user is 3/4 down the page you can try this one
要检测用户是否在页面的3/4,你可以试试这个。
$(window).scroll(function() {
if($(window).scrollTop() + $(window).height() > $(document).height() - .75*$(document).height()) {
alert("3/4th of bottom!");
}
});