views:

77

answers:

2

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

+2  A: 

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

Chris Pietschmann
+1 and accepted, as this helped
alex
A: 

I feel stupid... this returns a number I can use:

    console.log($('#text').attr('scrollTop'));
alex
alternatively use jQuery's built in $('#text').scrollTop()
cobbal