Created
January 6, 2014 15:37
-
-
Save unknownuser88/8284556 to your computer and use it in GitHub Desktop.
JQUERY CHECK IF DIV SCROLLED TO END
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(document).ready(function(){ | |
$('div').bind('scroll',chk_scroll); | |
}); | |
function chk_scroll(e) | |
{ | |
var elem = $(e.currentTarget); | |
if (elem[0].scrollHeight - elem.scrollTop() == elem.outerHeight()) | |
{ | |
console.log("bottom"); | |
} | |
} | |
Other ways: | |
//scrollTop refers to the top of the scroll position, which will be scrollHeight - offsetHeight | |
if( obj.scrollTop == (obj.scrollHeight - obj.offsetHeight)) { } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment