Jquery 判断滚动条到达顶部或底部 (可用于上拉下拉加载刷新)
<script type="text/javascript"> $(document).ready(function() { $(window).scroll(function() { //$(document).scrollTop() 获取垂直滚动的距离 //$(document).scrollLeft() 这是获取水平滚动条的距离 if ($(document).scrollTop() <= 0) { alert("滚动条已经到达顶部为0"); } if ($(document).scrollTop() >= $(document).height() - $(window).height()) { alert("滚动条已经到达底部为" + $(document).scrollTop()); } }); });</script>
声明:本站所有文章资源内容,如无特殊说明或标注,均为采集网络资源。如若本站内容侵犯了原著者的合法权益,可联系本站删除。