views:

81

answers:

1

Hi folks,

I am using jQuery's scrollTo to make relative adjustments in the position of content inside a div.

Works fine: http://www.hmadvertising.com/test.php

However I also want to show and hide the control elements when they aren't relevant. Eg no Up button when scrollTop is zero and no down when scrollTop == scrollHeight.

The adjustments I make using scrollTo are in 100px increments using += and -=. I was noticing it always took one more click than it should to do my show/hide so I dumped scrollTop to screen using the scrollTo post effect callback "onAfter" and found that when the content has reached either extreme that scrollTop is reported to be off still by x amount and doesn't hit the max/min until that next click despite the fact that the content is positioned at it's max/min.

You can see all of this at the link above.

Can anyone help me to understand it better?

Thanks,

JG

A: 

Just thought to echo scrollTop via FireBug's console. It reflects the expected value so this is apparently an issue with jQuery's onAfter firing before the scroll is done.

jerrygarciuh