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]
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]
Comment