ajax实现滚动刷新,jquery如何实现滚动自动加载
前提:引入jquery文件。
html
啊
啊
啊
啊
啊
啊
啊
啊
啊
啊
啊
啊
啊
啊
啊
啊
啊
啊
啊
啊
啊
啊
啊
啊
啊
啊
啊
啊
css
*{
margin: 0;
padding: 0;
}
#app{
width: 320px;
height: 600px;
margin: 0 auto;
border: 1px solid #000;
position: relative;
overflow: hidden;
}
header{
width: 100%;
height: 50px;
background: orange;
}
#search{
width: 100%;
height: 30px;
background: pink;
}
footer{
position: absolute;
left: 0;
bottom: 0;
width: 100%;
height: 50px;
background: blue;
}
#content{
position: absolute;
top: 80px;
bottom: 50px;
width: 100%;
overflow: auto;
}
js
$(function(){
$('#content').scroll(function(){
var scrollTop = $(this).scrollTop();
var height = $(this).height();
var scrollHeight = $(this)[0].scrollHeight;
if(scrollTop + height >= scrollHeight){//關(guān)鍵
console.log('load');
}
})
});
總結(jié)
以上是生活随笔為你收集整理的ajax实现滚动刷新,jquery如何实现滚动自动加载的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 查网站服务器ip 被k,网站被K的排查方
- 下一篇: ajax中提交属性table,wicke