Change hash without reload in jQuery

前端 未结 5 1776
耶瑟儿~
耶瑟儿~ 2020-12-04 17:23

I have the following code:

$(\'ul.questions li a\').click(function(event) {
    $(\'.tab\').hide();
    $($(this).attr(\'href\')).fadeIn(\'slow\');
    event         


        
5条回答
  •  青春惊慌失措
    2020-12-04 18:01

    You can set your hash directly to URL too.

    window.location.hash = "YourHash";
    

    The result : http://url#YourHash

提交回复
热议问题