写这个点击回到顶部。我采用的是最简单的jQuery,的点击事件  和animate特效。

html部分

<div class="pulltop">
<img src="img/top.png"/>

</div>

jQuery

$(".pulltop").click(function () {
       $("html,body").animate({scrollTop:'0px'},500); //回到顶部
        });

等我会原生写的时候再和你们说哈  耶

 

相关文章:

  • 2022-12-23
  • 2022-01-17
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-10-05
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案