简体   繁体   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