Created
October 1, 2019 17:50
-
-
Save techb/f906d4cf053da2cecdd7390a6d48bc6d to your computer and use it in GitHub Desktop.
Check if a div or container can scroll, jQuery
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
jQuery(function($) { | |
$(".my-selector").on('scroll', function() { | |
if($(this).scrollTop() + $(this).innerHeight() >= $(this)[0].scrollHeight) { | |
// at the bottom, do stuff like hide a down arrow | |
$(".down-arrow").addClass("hide"); | |
}else{ | |
// not at bottom, show down arrow or something else | |
$(".down-arrow").removeClass("hide"); | |
} | |
}) | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment