[html] 回到页首

[转]本文来自: 最简单最强大的插件框架(Net 2.0+)
http://www.cnblogs.com/baihmpgy/p/3305215.html
<!doctype html>
<html>
 <head>
  <meta charset="UTF-8">
  <title>Document</title>
  <style type="text/css">
    #toTop{
        width:100px;
        border:1px solid #ccc;
        background:#f7f7f7;
        text-align:center;
        padding:5px;
        position:fixed;
        bottom:10px;
        right:10px;
        cursor:pointer;
        display:none;
        color:#333;
        font-size:11px;
    }
  </style>
 </head>
 <body>
  <div style="height:2000px;">http://www.iopenworks.com/Documents/DocumentsList</div>
  <script src="js/jquery.min.js" type="text/javascript"></script>
  <script type="text/javascript">
        $(document).ready(function () {
            $('#Documents').addClass("currentPage");
            $(window).scroll(function () {
                if ($(this).scrollTop() > 200) {
                    $('#toTop').fadeIn();
                } else {
                    $('#toTop').fadeOut();
                }
            });

            $('#toTop').click(function () {
                $('body,html').animate({ scrollTop: 0 }, 800);
            });
        });    
  </script>

  <div id="toTop">^ Top</div>
 </body>
</html>

 

转载于:https://www.cnblogs.com/z5337/p/4857132.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值