javascript top.location.hash = ""; without browser jumping to top?
top.location.has开发者_StackOverflowh = "";
adds a # to my addressbar. As soon as top.location.hash = "";
is called and a # is added my browser window jumps to its top.
Is there any chance a could prevent that?
$('#element').live('click', function() {
top.location.hash = "map";
});
Just change the hash to something that is not significant and never used, e.g. an underscore. AFAIK, changing the hash to nothing will always scroll the page to the top.
精彩评论