gpt4 book ai didi

javascript - 如何知道
标签的滚动事件结束

转载 作者:数据小太阳 更新时间:2023-10-29 05:40:37 27 4
gpt4 key购买 nike

如果滚动结束到达 div 标签,我需要触发一个函数..

    $("#page").bind("scroll",function(e){ //page is the ID of the div im scrolling
if (document.body.scrollHeight - $(this).scrollTop() <= $(this).height())
{
//the code here is called every time the scroll is happened i want to call
//this only when the scroll reaches the end of div
}
});

最佳答案

$("#page").scroll( function() {
if($(this)[0].scrollHeight - $(this).scrollTop() == $(this).outerHeight()) {
// what you want to do ...
}
});

关于javascript - 如何知道 <div> 标签的滚动事件结束,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4244841/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com