开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜