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

     1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
     2     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
     3 <html>
     4 <head>
     5 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
     6 <title>dom</title>
     7 <style>
     8 * {
     9     margin:0;
    10     padding:0;
    11 }
    12 .toTop {
    13     display:inline-block;
    14     width:30px;
    15     height:30px;
    16     background-color:#969;
    17     fond-size:22px;
    18     line-height:30px;
    19     text-align:center;
    20     position:fixed;
    21     bottom:50px;
    22     right:20px;
    23     color:#fff;
    24     cursor:pointer;
    25 }
    26 </style>
    27 </head>
    28 <body>
    29     <p>2</p><p>121</p><p>121</p><p>121</p><p>0</p><p>121</p><p>121</p><p>121</p><p>121</p><p>121</p><p>121</p><p>121</p><p>121</p><p>121</p><p>121</p><p>121</p><p>121</p><p>121</p><p>121</p><p>121</p><p>121</p><p>121</p><p>121</p><p>121</p><p>121</p><p>121</p><p>121</p><p>121</p><p>121</p><p>121</p><p>121</p><p>121</p><p>7</p><p>121</p><p>121</p><p>121</p><p>121</p><p>121</p><p>121</p><p>121</p><p>121121121</p><p>121</p><p>121</p><p>121</p><p>121</p><p>121</p><p>121</p><p>121</p><p>121</p><p>121</p><p>121</p><p>121</p><p>121</p><p>5</p><p>121</p><p>121121</p><p>121</p><p>121</p><p>121</p><p>121</p><p>121</p><p>121</p><p>121</p><p>121</p><p>121</p><p>121</p><p>121</p><p>121</p><p>121</p><p>121</p><p>121</p><p>121</p><p>9</p><p>121</p><p>121</p><p>121</p><p>121</p><p>121121121</p><p>121</p><p>121</p><p>121</p><p>121</p><p>121</p><p>121</p><p>121</p><p>121</p><p>121</p><p>121</p><p>121</p><p>121</p><p>121</p><p>121</p><p>121</p>
    30     <a class="toTop"></a>
    31 <script src="../../../../js/jquery.min.js"></script>
    32 <script>
    33     $('.toTop').click(function(){
    34         $('body').stop().animate({scrollTop:$('body').offset().top},500);  //{scrollTop:0}
    35         return false;    
    36     });
    37 
    38     /*jQuery.fn.scrollTo = function(speed){
    39         var $target = $(this).offset().top;
    40         $('html,body').stop().animate({scrollTop:$target},speed)    
    41     };
    42     $(function(){
    43         $('.toTop').click(function(){
    44             $('body').scrollTo(500);
    45             return false;    
    46         });
    47     });*/
    48 </script>
    49 </body>
    50 </html>
  • 相关阅读:
    超出宽度...显示
    javascript 浏览器兼容 统计输入字数
    javascript常用工具类
    全局inline-block
    如何设计一套通用消息交互系统
    浅谈.NETfarmwork
    windows 安装gitlab
    阿里云ACP 云计算专业考试分享 2021最新
    Linux将一般用户加入sudo组
    RabbitMQ基础学习
  • 原文地址:https://www.cnblogs.com/vscss/p/5538775.html
Copyright © 2011-2022 走看看