zoukankan      html  css  js  c++  java
  • css3 下拉缩放显示定位导航

    简单的一个Demo:

    <!DOCTYPE html>
    <html lang="en">
    <head>
    <meta charset="UTF-8">
    <title>Document</title>
    <style>
    body{height: 3000px;}
    .box{
        width: 100px;
        height: 200px;
        background-color: rgb(58, 119, 106);
        position: absolute;
        z-index: 1;
        left: 100px;
        top: 0;
        -webkit-transition: all 0.3s;
        transition: all 0.3s;
    }
    .transition{
        /* 缩放 */
        -webkit-transform: scale3d(0,0,1);
        transform: scale3d(0,0,1);
        /* 定中心点 */
        -webkit-transform-origin: center center;
        transform-origin: center center;
    }
    .fix{
        position: fixed;
    }
    </style>
    </head>
    <body>
        <div class="box transition" id="box"></div>
    <script src="http://s.lamahui.com/jquery/jquery-2.1.1.min.js"></script>
    <script>
    $(function(){
        $(window).scroll( function() {
            var t = $(window).scrollTop();
            if(t > 400){
                $('#box').removeClass('transition').addClass('fix');
            }else{
                $('#box').addClass('transition').addClass('fix');
            }
        });
    });
    </script>
    </body>
    </html>
    高否?富否?帅否? 否? 滚去学习!
  • 相关阅读:
    vue工作篇
    idea快捷键
    idea怎么随时随地调整字体大小
    idea配置maven
    idea启动加速
    idea配置tomcat
    idea设置哪个浏览器打开
    jsonArray和jsonObject的理解
    多文件上传保存到本地服务器
    并发编程
  • 原文地址:https://www.cnblogs.com/baixc/p/4323342.html
Copyright © 2011-2022 走看看