coo*_*guy 5 javascript jquery scroll
如果滚动结束已到达div标签,我需要触发一个函数.
$("#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
}
});
Run Code Online (Sandbox Code Playgroud)
Ram*_*din 21
$("#page").scroll( function() {
if($(this)[0].scrollHeight - $(this).scrollTop() == $(this).outerHeight()) {
// what you want to do ...
}
});
Run Code Online (Sandbox Code Playgroud)