Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
当一个 div 滚动到它的底部时,我怎么能得到一个事件?当它滚动到底部时,我需要将新数据附加到 div 中。
您可以在窗口上使用 jQuery 的.scroll()事件,如下所示:
.scroll()
$(window).scroll(function() { if($(window).scrollTop() + $(window).height() == $(document).height()) { $("#div_id").append("New Text"); } });