zoukankan      html  css  js  c++  java
  • HTML页面实现返回顶部效果 go to top

    1、首先导入jQuery插件。

    2、js代码:

    $(window).scroll(function () {
         if($(window).scrollTop()>=100) {
               $(".backtop").fadeIn();
         }else {
                                        
               $(".backtop").fadeOut();
         }
    });
                            
                        
    $(".backtop").click(function(event){    
           $('html,body').animate({scrollTop:0}, 500);
           return false;
     });

    3、css代码:

    a.backtop {
                    background: url("./sw/images/backtotop.png") no-repeat scroll center center rgba(0, 0, 0, 0);
                    bottom: 20px;
                    cursor: pointer;
                    display: none;
                    height: 70px;
                    position: fixed;
                    right: 20px;
                    text-indent: -9999px;
                    width: 70px;
                    z-index: 100;
                }

    4、页面代码:

    <a class="backtop" >
                                <h6>返回顶部啊</h6>
                            </a>
  • 相关阅读:
    vim python extension
    aws msk
    Install python3
    sns
    inventory
    批量添加监听端口
    template screen
    DNS name
    add jar and proxy repo
    模型诊断论文心得
  • 原文地址:https://www.cnblogs.com/tq03/p/3985502.html
Copyright © 2011-2022 走看看