Reputation: 1208
I'm using jQuery tabs, an click on a tab it add hash to the url
jQuery( "#tabs").tabs({
activate: function(event, ui) {
window.location.hash = ui.newPanel.attr('id');
}
});
problem is when i click on a tab it opens but it scroll and jump to top of the page
Anyone know how to fix this issue
Upvotes: 0
Views: 423
Reputation: 20039
Try using history.pushState()
. Check History Api docs
jQuery( "#tabs").tabs({
activate: function(event, ui) {
history.pushState(null, null, '#' + ui.newPanel.attr('id'));
}
});
Upvotes: 2