I assume you are animating your tabbed transitions? I have the same problem when a page scroll jumps up with each click.
I found this in jquery source:
Of course, if I have this:
$('.tab_container > ul').tabs(); $('.tab_container > ul').tabs({ fx: { height: 'toggle', opacity: 'toggle', duration: 'fast' } });
my code jumps up and annoys (but there is animation). If I changed this to the following:
$('.tab_container > ul').tabs(); //$('.tab_container > ul').tabs({ fx: { height: 'toggle', opacity: 'toggle', duration: 'fast' } });
There is no tab animation, but switching between tabs is smooth.
I found a way to do this by scrolling backwards, but this is not a correct fix, as the browser still jumps at the top after clicking on the tab. Scrolling occurs between the tabsselect and tabsshow events, so the following code returns to your tab:
var scroll_to_x = 0; var scroll_to_y = 0; $('.ui-tabs-nav').bind('tabsselect', function(event, ui) { scroll_to_x = window.pageXOffset; scroll_to_y = window.pageYOffset; }); $('.ui-tabs-nav').bind('tabsshow', function(event, ui) { window.scroll(scroll_to_x, scroll_to_y); });
I will do everything that I have done.
Brian Ramsay Oct 28 '08 at 22:22 2008-10-28 22:22
source share