簡體   English   中英

僅當用戶滾動到頁面底部時,如何添加顯示DOM元素的jQuery事件監聽器(在這種情況下為iframe)

[英]How do I add a jQuery Event Listener that show a DOM element in this case an iframe only if the user has scrolled to the bottom of the page

如何添加僅當用戶滾動到頁面底部時才顯示DOM元素(在本例中為iframe)的jQuery事件監聽器。

$(window).scroll(function(){
    if ($(document).scrollTop() + $(window).height() == $(document).height()) {
      $('iframe').fadeIn();
    } else {
      $('iframe').stop(true, true).fadeOut();
    };
});

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM