I need to make a check using jquery If the users scrolled near the bottom of an element. I have an element named wrapper with overflow: scroll,and ever solution i can find is about the entite document. How can you make this check in a different element than the body
Asked
Active
Viewed 43 times
0
-
Possible duplicate of [Detecting when user scrolls to bottom of div with jQuery](http://stackoverflow.com/questions/6271237/detecting-when-user-scrolls-to-bottom-of-div-with-jquery) – Deep 3015 Feb 18 '17 at 18:09
1 Answers
0
var wantedElementBottom = $("#wanted-element").offset().top + $("#wanted-element").height();
$(window).scroll(function(){
if($(window).scrollTop() === wantedElementBottom) {
alert('im here')//do something
})
})

Nir Ben-Yair
- 1,566
- 3
- 14
- 18