Reputation: 490547
I am using this code on a 'down' button to scroll text in an overflowed div.
var textHeight = text.outerHeight();
var pageDown = $('#page-down');
var pageUp = $('#page-up');
pageDown.bind('click', function () {
pageUp.fadeIn(500);
text.animate({ scrollTop: '+=' + textHeight + 'px' }, 500);
});
This is working nicely, but I need a method to determine when the scroll down button should disappear ... i.e. when the last content has appeared inside the div.
Is there a property or method to get the scrolled position within that div? Thanks
Upvotes: 2
Views: 244
Reputation: 490547
I feel stupid... this returns a number I can use:
console.log($('#text').attr('scrollTop'));
Upvotes: 0
Reputation: 29905
Here's a couple links you may want to look at:
http://yelotofu.com/2008/10/jquery-how-to-tell-if-youre-scroll-to-bottom/
http://www.mail-archive.com/[email protected]/msg22400.html
Upvotes: 2