How do I navigate to hashtag after page load?

后端 未结 5 1087
忘掉有多难
忘掉有多难 2021-02-01 07:38

I want to do the inverse of what I\'ve been finding so far. I\'m setting a lot of heights with js and I want to navigate to the hashtag in the url after the page has loaded. I\'

5条回答
  •  独厮守ぢ
    2021-02-01 08:41

    You could just set the current location:

    window.location = 'http://alavita.rizenclients.com/#story';
    

    Or set the hash (if it isn't already), then reload:

    window.location.hash = hashTag;
    window.location=window.location.href;
    

提交回复
热议问题