解决方法
How to tell when you’re at the bottom of a page:
if ( document.documentElement.clientHeight + $(document).scrollTop() >= document.body.offsetHeight ) { // Display alert or whatever you want to do when you're // at the bottom of the page. alert("You're at the bottom of the page."); }
当然,只要用户滚动,您都想要触发上述操作:
$(window).scroll(function() { if ( document.documentElement.clientHeight + $(document).scrollTop() >= document.body.offsetHeight ) { // Display alert or whatever you want to do when you're // at the bottom of the page. alert("You're at the bottom of the page."); } });
Here is a jsFiddle example,当用户滚动到页面底部时,它会淡出“您完成!滚动到页首”链接.
参考文献: