//滚动条加载底部自动加载$(function(){//鼠标滚动事件 $(window).scroll(function(){console.log("滚动条到顶部的垂直高度:" + $(window).scrollTop() ); console.log("页面的文档高度:" + $(document).height() ); console.log("浏览器的高度:" + $(window).height() );//下面这句主要是获取网页的总高度,主要是考虑兼容性所以把Ie支持的documentElement也写了,这个方法至少支持IE8varhtmlHeight=document.body.scrollHeight||document.documentElement.scrollHeight; //clientHeight是网页在浏览器中的可视高度,varclientHeight=document.body.clientHeight||document.documentElement.clientHeight; //scrollTop是浏览器滚动条的top位置,varscrollTop=document.body.scrollTop||document.documentElement.scrollTop; //通过判断滚动条的top位置与可视网页之和与整个网页的高度是否相等来决定是否加载内容;if(scrollTop+clientHeight==htmlHeight){start+=length; findBookList(start,length); // 延时 // setTimeout(function () { // // },1000) }})
600字范文,内容丰富有趣,生活中的好帮手!