前端切图:一句代码实现返回顶部

5640239-8e5fcb0cc3d8dfaf.png
图片发自简书App

首先引入js文件

<script type="text/javascript" src="http://hovertree.com/ziyuan/jquery/jquery-1.11.3.min.js";></script>
  <script type="text/javascript" src="http://hovertree.com/texiao/yestop/inc/jquery.yestop.js";></script>

一句重要代码实现

<script type="text/javascript">
    $(document).ready(function () { $.fn.yestop(); })
  </script>

demo如下

<!DOCTYPE html>
<html>
<head><meta charset="UTF-8">
  <title>YesTop - HoverTree</title><meta name="viewport" content="width=device-width, initial-scale=1.0">
  <script type="text/javascript" src="http://hovertree.com/ziyuan/jquery/jquery-1.11.3.min.js";></script>
  <script type="text/javascript" src="http://hovertree.com/texiao/yestop/inc/jquery.yestop.js";></script>
  <style>
    body {
      margin: 0px;font-family:Arial
    }a{color:blue}
  </style>
</head>
<body>
  <div style="text-align:center;100%;margin:0px auto;">
    <h1>我是不是前端妹子啊???</h1>
   你是妹子??<br />
  
  </div>
  <div style="height: 1000px;background-color: blanchedalmond;">
   
  </div>
 
  <script type="text/javascript">
    $(document).ready(function () { $.fn.yestop(); })
  </script>
</body>
</html>

OK了,一句代码写完,不用在写很多东西咯
仿知乎返回顶部

原文地址:https://www.cnblogs.com/ting6/p/9725811.html