获取元素、浏览器、页面显示区域(可视区域)的高度:
$(‘.class‘).height();
$(window).height();
$(document).height();
获取元素、浏览器、页面 的滚动条到顶部的垂直高度:
$(‘.class‘).scrollTop();
$(window).scrollTop();
$(document).scrollTop();
获取元素、浏览器、页面 的包含滚动条的垂直高度:
$(‘.class‘)[0].scrollHeight 或者 document.getElementById("id").scrollHeight;
$(document).innerHeight;
$(window).innerHeight;
示例:判断容器滚动条,滚到底部,代码:
$(‘.class‘).scroll(function(){ if( $(this).height() + $(this).scrollTop() == $(this)[0].scrollHeight ){ alert(‘bottom‘); } });
原文:https://www.cnblogs.com/feiying100/p/12812699.html