Javascript tips
Hash changing
November 5, 2011

I  found a nice way to prevent page scrolling after changing the window.location.hash:

function changeHashWithoutScrolling(hash) {
var id = hash.replace(/^.*#/, ”);
elem = document.getElementById(id); = id+’-tmp’;
window.location.hash = hash; = id;

Leave a Reply

By continuing to use the site, you agree to the use of cookies. more information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.