• 一阶段项目总结 之 滚动监听回顶部


    HTML代码:

    <!-- 回顶部 -->
      <div class="jiantou">
       <a>↑</a>
      </div>

    CSS代码:

    jiantou{

      40px;
     height: 40px;
     line-height: 40px;
     background: rgba(202,54,33,.7);
     color: #fff;
     text-align: center;
     font-size: 26px;
     font-weight: 900;
     bottom:20px ;
     right: 40px;
     transition: all .3s;
     text-decoration: none;

     position: fixed;
     z-index: 99;
     display: none;
     cursor: pointer;
    }
    .jiantou a{
     color: white;
    }

    JQ代码:

    $(function() {
        /* 回顶部 */
        $(window).scroll(function() {
         var hui = $(document).scrollTop();
         // alert(hui);
         // console.log(hui);
         if (hui > 300) {
          $(".jiantou").fadeIn();
         } else {
          $(".jiantou").fadeOut();
         }
        })
        $(".jiantou").click(function(){
         $("html,body").animate({
         scrollTop:'0px'},500);
        })
       }) 

  • 相关阅读:
    UNIX常用shell
    exit函数
    linux消息队列
    互斥量
    RCS版本控制
    linux samba
    UML建模
    linux syslog
    python基础-列表List及内置方法
    仿美团详情页与购物车源码-详情页
  • 原文地址:https://www.cnblogs.com/zqy6666/p/11966467.html
Copyright © 2020-2023  润新知