我一直在尝试检测用户滚动何时到达底部
我有下面的代码。
if ($(window).scrollTop() == ($(document).innerHeight() - $(window).height())){
alert('22')
}
这里的问题是,$(window).height() 返回的结果与 $(document).height() 相同,它比实际的窗口视口大。
我的屏幕结果约为 1280 像素。
但是 $(document).height 返回 1670,$(window).height() 也是如此。
所以 document.height - window.height 总是 0
难道我做错了什么?
我正在使用 Mac OSx Chrome。
谢谢
//////////////////////
window.innerHeight 和 document.height 解决了 Sushil 建议的问题