Returning to the last vertical position in jQuery Tabs tab
I have a web page with only a jQueryUI Tabs with several tabs.
One of the tabs can be very long, so it causes the browser to show the vertical scrollbar. When the users scroll down the tab, and then select another tab, which is very small, the browser hides the vertical scrollbar. When they return to the long tab, the scro开发者_高级运维llbar reapears but in its top position
I need the long tab to remember the last position, so when the users return to the tab, they can continue reading where they were before switching tabs.
Is something like this possible?
Just fixed this same issue. Sounds like it is a webkit browser issue.
Use the tab event 'tabsselect' to save the current scroll pos and the 'tabsshow' event to restore it.
Something like this:
var _currentTab = 0;
var _currentScroll = 0;
$("#nav_tab").bind('tabsselect',function(e,ui){
if (_currentTab === 0) {
_currentScroll = $('<your scroll item>').scrollTop();
}
_currentTab = ui.index;
}).bind('tabsshow',function(e,ui){
if (ui.index === 0) {
$('<your scroll item>').scrollTop(_currentScroll);
}
});
精彩评论