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('下拉到底了'); } })