2017-02-18 54 views
0

我需要使用jquery进行检查如果用户在元素底部附近滚动。我有一个名为包装溢出的元素:滚动,我可以找到的解决方案是关于entite文档。你怎么能做出这种检查在不同的元素比身体检查用户是否接近元素底部

+0

的可能的复制[检测时用户滚动到使用jQuery的div的底部(http://stackoverflow.com/questions/6271237/detecting-when -user-滚动至底部的-DIV与 - jquery的) –

回答

0
var wantedElementBottom = $("#wanted-element").offset().top + $("#wanted-element").height(); 
    $(window).scroll(function(){ 
     if($(window).scrollTop() === wantedElementBottom) { 
      alert('im here')//do something 
    }) 
    })