Scroll to top JavaScript in HTML Website

后端 未结 4 1885
故里飘歌
故里飘歌 2021-01-26 13:17

I am trying to implement the scroll to top feature in my website: www.arrow-tvseries.com.

The \"button\" is seen on the website however it does not work properly, becaus

4条回答
  •  耶瑟儿~
    2021-01-26 14:07

    You can do the same thing with below code:

    $("a[href='#top']").click(function() {
      $("html, body").animate({ scrollTop: 0 }, "slow");
      return false;
    });
    

    Try this. Hope it helps.

提交回复
热议问题