600字范文,内容丰富有趣,生活中的好帮手!
600字范文 > jQuery实现滚动条动态加载

jQuery实现滚动条动态加载

时间:2021-04-17 00:11:50

相关推荐

jQuery实现滚动条动态加载

//滚动条加载底部自动加载$(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) }})

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。