What is the matter with <div>'s scrollHeight

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • quangnd412
    New Member
    • Feb 2008
    • 1

    What is the matter with <div>'s scrollHeight

    Hi guys,
    I want to scroll a DIV. When the DIV scroll the the bottom, it will scroll upward and vice versa. The problem is: When it scroll to the bottom, odivScrollBarSt ockInfo.scrollT op can not be increased any more but it is still less than odivScrollBarSt ockInfo.scrollH eight!!!
    In order to make it work, I have to write a funny code (bold lines).
    What is the problem here?

    Please look at this code

    [CODE=javascript]function _scrollTables()
    {
    var scrollTop = odivScrollBarSt ockInfo.scrollT op;
    scrollTop += scrollStep * scrollDirection ;

    if(scrollTop < 0)
    {
    scrollDirection = 1;
    }
    else if(scrollTop > odivScrollBarSt ockInfo.scrollH eight)
    {//this never can be reached!!!
    scrollDirection = -1;
    }
    else
    {
    odivScrollBarSt ockInfo.scrollT op = scrollTop;
    //funny code
    if(odivScrollBa rStockInfo.scro llTop != scrollTop)
    {
    scrollDirection = -1;
    }

    }
    setTimeout("_sc rollTables()",s crollDelay);
    }[/CODE]
    Last edited by acoder; Feb 13 '08, 08:27 AM. Reason: Added code tags
  • acoder
    Recognized Expert MVP
    • Nov 2006
    • 16032

    #2
    Welcome to TSDN!

    See if this page helps.

    Comment

    Working...