Stop default hashtag behavior with jquery

后端 未结 3 543
孤独总比滥情好
孤独总比滥情好 2020-12-16 04:20

I\'m using the following code to append a hashtag to the end of a url. That way someone can copy that url and take them back to that page, with certain divs visable.

3条回答
  •  星月不相逢
    2020-12-16 04:49

    Try this:

    $("a.live").click(function() {
        window.location.hash = 'live'; 
        $("#live").slideDown();
        return false; // this will prevent default action
    });
    

提交回复
热议问题