手记

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>

0人推荐
随时随地看视频
慕课网APP