Skip to content

Instantly share code, notes, and snippets.

@aarongustafson
Created September 8, 2010 20:25
Show Gist options
  • Save aarongustafson/570773 to your computer and use it in GitHub Desktop.
Save aarongustafson/570773 to your computer and use it in GitHub Desktop.
Makes sure the layout is loaded (Webkit sometimes loses the design when the back button is used to return to a URL using a hash and slash anchor structure)
// make sure a user hitting the back button doesn't kill the layout
if ( window.addEventListener )
{
window.addEventListener('pageshow',function(e){
if (e.persisted)
{
setTimeout(function(){
window.scrollTo(window.scrollX,window.scrollY+1);
},10);
}
}, false);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment