height()获取的是可见高度;
scrollHeight获取的是滚动内容的高度;
scrollTop()获取的是距离滚动顶部的高度;
scrollHeight=scrollTop+height。
注意:滚动事件绑定要生效必须先确定元素(如#scroll)的width、height以及overflow:scroll;
例:(下拉至#scroll元素底部100时加载内容)
$('#scroll').scroll(function() { view =$(this).height();//可见高度 content =$(this).get(0).scrollHeight;//内容高度 scrollTop =$(this).scrollTop();//滚动高度 if (content - view - scrollTop <= 100 ) { alert("加载内容"); } });