Skip to content

Commit

Permalink
Stop Chrome redrawing the page when programatically updating the hash
Browse files Browse the repository at this point in the history
  • Loading branch information
Richard Cox committed Jan 22, 2015
1 parent b2728c5 commit 9cb8246
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion js/jquery.responsiveTabs.js
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,17 @@

// Check if hash has to be set in the URL location
if(_this.options.setHash) {
window.location.hash = activatedTab.selector;
// Set the hash using the history api if available to tackle Chromes repaint bug on hash change
if(history.pushState) {

history.pushState(null, null, activatedTab.selector);

} else {

// Otherwise fallback to the hash update for sites that don't support the history api
window.location.hash = activatedTab.selector;

}
}

e.data.tab._ignoreHashChange = true;
Expand Down

0 comments on commit 9cb8246

Please sign in to comment.