js 判断div距离浏览器顶部或者底部的距离
作者:互联网
$(window).scroll(function() {
var scrollTop = $(this).scrollTop();
var scrollHeight = $(document).height();
var windowHeight = $(this).height();
if(scrollTop == 0){ alert('顶部'); } if(scrollTop + windowHeight == scrollHeight ){ alert('下拉到底了'); } })
if(scrollTop == 0){ alert('顶部'); } if(scrollTop + windowHeight == scrollHeight ){ alert('下拉到底了'); } })
标签:距离,height,alert,windowHeight,var,scrollTop,div,js,scrollHeight 来源: https://www.cnblogs.com/hlhs/p/11770007.html