Hi all,

there was one thing that always bothered me (and others on my blog) for 
the tabs plugin: That they weren't truly bookmarkable (only the one to 
start with).

If I remove the "return false" from the click handler the URL is changed 
   and you get a nice bookmark. Downside is, that the page scrolls to 
the element that is refered to in the hash of the url, or it scrolls to 
the top if you would use a hash that has no counterpart in the document. 
And I didn't want to use undefined hashes anyway for the sake of 
unobtrusiveness and graceful degradation.

So I now save the scrollbars position and set them back to where they 
were on tab click.

Now comes the part I don't quite understand. The technique worked 
perfectly on tabs with an animation, but didn't for tabs that simply 
switched. On these you would see the scrollbar move to the top and then 
back to its old position, resulting in a flicker of the whole page.

Simply enough, I therefore use an animation for any tab switch and it 
was sufficient to make it last one millisecond to avoid the jumping 
scrollbar (so this isn't remarkable at all and behaves like a simple tab 
switch).

Does anyone here know why that is? Anyway, it works and I think it's a 
great improvement.

See here in action:
http://stilbuero.de/jquery/tabs/

I have tested that in Safari and Firefox and Opera so far, in IE I think 
I simply do not get the right value for the scroll coordinates yet. 
Maybe someone can give me a hint...


Cheers, Klaus

_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/

Reply via email to