zoukankan      html  css  js  c++  java
  • 返回顶部实例

     1 <!DOCTYPE html>
     2 <html>
     3 <head>
     4     <title>返回顶部实例</title>
     5     <style>
     6         .c1 {
     7             width: 80px;
     8             height: 30px;
     9             position: fixed;
    10             bottom: 20px;
    11             right: 20px;
    12             background-color: yellow;
    13  
    14         }
    15         .hide {
    16             display: none;
    17         }
    18      
    19     </style>
    20 </head>
    21 <body>
    22  
    23 <input type="button" name="" value="click me!" class="c1 hide">
    24  
    25 <script type="text/javascript" src="jquery-3.2.1.min.js"></script>
    26 <script>
    27     $(window).on("scroll", function(){
    28         if ($(window).scrollTop()>200){
    29             $(".c1").removeClass("hide");
    30         } else {
    31             $(".c1").addClass("hide");
    32         }
    33     });
    34     $(".c1").on("click", function(){
    35         $(window).scrollTop(0);
    36     });
    37 </script>
    38  
    39 </body>
    40 </html>
  • 相关阅读:
    如何复用网页
    sap
    学习方法
    spring + ehcache 实例
    200个 jquery插件
    vs 示例代码浏览器 搜索
    struts jquery 整合
    eclipse clean 后clease 为空
    mvc相关
    css 框架
  • 原文地址:https://www.cnblogs.com/changwoo/p/9578442.html
Copyright © 2011-2022 走看看