• 返回顶部的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>
  • 相关阅读:
    [Lua]可变参数:"arg"和"..."
    三维模型obj文件的格式解析与读取
    多线程:如果在调用线程时传递参数
    C#正则表达式类Match和Group类的理解
    利用带关联子查询Update语句更新数据
    多线程:C#线程同步lock,Monitor,Mutex,同步事件和等待句柄(上)
    ASP.NET如何防止页面重复提交
    多线程:C#线程同步lock,Monitor,Mutex,同步事件和等待句柄(中)
    委托和事件:从猫和老鼠的故事看事件
    .NET Remoting学习点滴(一):简单示例
  • 原文地址:https://www.cnblogs.com/vscss/p/5538775.html
Copyright © 2020-2023  润新知