问题:下拉滚动条,加载下一页文档,当下一页文档加载完毕(DOM加载完)后,我怎么捕捉这一事件,怎么写监听事件?
监听滚动条的代码如下:
$(window).scroll(function () {
var scrollTop = $(this).scrollTop();
var scrollHeight = $(this).height();
var documentHeight = $(document).height();
if (scrollTop != 0 && (scrollTop + scrollHeight == documentHeight)) {
updateWaterfall();
}
});
我尝试使用resize方法,但是这个方法只有在窗口整体变化时才会触发,下拉下拉框只会改变文档的高度,宽度并没有变化所以没有触发resize。请问这个该怎么处理?
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
你直接监听文档加载完毕就好啦。监听高度写的太死。直接监听文档加载完毕(监听他不加载了)。
既然你想监听height的改变,那有一个土办法,用定时器定时检查height的高度变化。