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>
    高否?富否?帅否? 否? 滚去学习!
  • 相关阅读:
    数据库存储语句
    数据库练习总结
    数据库练习
    数据库增添
    数据库创建
    cookie 和 session的区别 & 三种传值方式
    内置对象——cookie
    webform跨页面传值
    复合控件
    repeater(控件)数据展示
  • 原文地址:https://www.cnblogs.com/baixc/p/4323342.html
Copyright © 2011-2022 走看看