I need to trigger a function if scroll end has reached for a div tag ..
$("#page").bind("scroll",function(e){ //page is the ID of the div im scrolling
if (document.body.scrollHeight - $(this).scrollTop() <= $(this).height())
{
//the code here is called every time the scroll is happened i want to call
//this only when the scroll reaches the end of div
}
});
$("#page").scroll( function() {
if($(this)[0].scrollHeight - $(this).scrollTop() == $(this).outerHeight()) {
// what you want to do ...
}
});
$("#page").bind("scroll",function(e){ //page is the ID of the div im scrolling
if ( ( $(this).height() + $(this).scrollTop() ) => $(this).innerHeight() )
{
//Test it first without padding. Then see if you need to tweak the left part of the condition
}
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With