全屏隐藏菜单特效

<!doctype html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> 
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>全屏隐藏菜单特效</title>
 
    <style type="text/css">
    * { margin: 0px; padding: 0px; }
    body {
        background: #383c55;
        width: 100%; 
        height: 100%;
    }
    #view-code{
      color:#4183d7; 
      font-size:13px;
      text-transform:uppercase;
      font-weight:700;
      text-decoration:none;
      position:absolute;top:640px; left:50%;margin-left:-35px;
    }
    div.screen{
        width:320px;
        height:560px;    
        overflow:hidden;
        position:absolute; 
        top:250px; 
        left:50%;
        margin-left:-160px;
        background:#31558a;
    }

    .list{margin-top:36px; text-align:left;}
    .item{
        height:115px;
        margin-top:30px 0;
        padding-left:115px;
        clear:both;
    }
    .item .img, .item span{background:#214273; border-radius:3px;}
    .item .img{float:left; width:71px; height:71px; margin-left:-93px;}
    .item span{height:11px; width:180px; margin-bottom:19px; float:left;}
    .item span:nth-of-type(3){width:75px; margin-botom:0;}

    div.burger {
        height: 30px; 
        width: 40px;
        position: absolute;
        top: 11px; 
        left: 21px;
        cursor: pointer;    
    }
        div.x,
        div.y,
        div.z {
            position: absolute; margin: auto;
            top: 0px; bottom: 0px;        
            background: #fff;
            border-radius:2px;
            -webkit-transition: all 200ms ease-out;
               -moz-transition: all 200ms ease-out;
                -ms-transition: all 200ms ease-out;
                 -o-transition: all 200ms ease-out;
                    transition: all 200ms ease-out;
        }        
        div.x, div.y, div.z { height: 3px; width: 26px; }
        div.y{top: 18px;}
        div.z{top: 37px;}
        div.collapse{
            top: 20px;
            background:#4a89dc;
            -webkit-transition: all 70ms ease-out;
               -moz-transition: all 70ms ease-out;
                -ms-transition: all 70ms ease-out;
                 -o-transition: all 70ms ease-out;
                    transition: all 70ms ease-out;
        }
         
        
        div.rotate30{
            -ms-transform: rotate(30deg); 
            -webkit-transform: rotate(30deg); 
            transform: rotate(30deg);    
            -webkit-transition: all 50ms ease-out;
               -moz-transition: all 50ms ease-out;
                -ms-transition: all 50ms ease-out;
                 -o-transition: all 50ms ease-out;
                    transition: all 50ms ease-out;                    
        }
        div.rotate150{
            -ms-transform: rotate(150deg); 
            -webkit-transform: rotate(150deg); 
            transform: rotate(150deg);    
            -webkit-transition: all 50ms ease-out;
               -moz-transition: all 50ms ease-out;
                -ms-transition: all 50ms ease-out;
                 -o-transition: all 50ms ease-out;
                    transition: all 50ms ease-out;                    
        }
        
        div.rotate45{
            -ms-transform: rotate(45deg); 
            -webkit-transform: rotate(45deg); 
            transform: rotate(45deg);    
            -webkit-transition: all 100ms ease-out;
               -moz-transition: all 100ms ease-out;
                -ms-transition: all 100ms ease-out;
                 -o-transition: all 100ms ease-out;
                    transition: all 100ms ease-out;                    
        }
        div.rotate135{
            -ms-transform: rotate(135deg); 
            -webkit-transform: rotate(135deg); 
            transform: rotate(135deg);    
            -webkit-transition: all 100ms ease-out;
               -moz-transition: all 100ms ease-out;
                -ms-transition: all 100ms ease-out;
                 -o-transition: all 100ms ease-out;
                    transition: all 100ms ease-out;                    
        }

    div.navbar{height:73px;background:#385e97;}

    div.circle{    
        border-radius: 50%;
        width: 0px;
        height: 0px; 
        position:absolute;
        top: 35px;
        left: 36px;
        background:#fff;
        opacity:1;
        -webkit-transition: all 300ms cubic-bezier(0.000, 0.995, 0.990, 1.000);
           -moz-transition: all 300ms cubic-bezier(0.000, 0.995, 0.990, 1.000);
            -ms-transition: all 300ms cubic-bezier(0.000, 0.995, 0.990, 1.000);
             -o-transition: all 300ms cubic-bezier(0.000, 0.995, 0.990, 1.000);
                transition: all 300ms cubic-bezier(0.000, 0.995, 0.990, 1.000);    
    }
    div.circle.expand{
        width:1200px;
        height:1200px;
        top: -560px;
        left: -565px;     
        -webkit-transition: all 400ms cubic-bezier(0.000, 0.995, 0.990, 1.000);
           -moz-transition: all 400ms cubic-bezier(0.000, 0.995, 0.990, 1.000);
            -ms-transition: all 400ms cubic-bezier(0.000, 0.995, 0.990, 1.000);
             -o-transition: all 400ms cubic-bezier(0.000, 0.995, 0.990, 1.000);
                transition: all 400ms cubic-bezier(0.000, 0.995, 0.990, 1.000);                    
        
    }
    div.menu {
        height: 568px; 
        width: 320px;
        position: absolute;
        top: 0px; left: 0px;
    }
    div.menu ul li {
        list-style: none;
        position:absolute;
        top:50px;;
        left:0;
        opacity:0;
        width:320px;
        text-align:center;
        font-size:0px;
        -webkit-transition: all 70ms cubic-bezier(0.000, 0.995, 0.990, 1.000);
           -moz-transition: all 70ms cubic-bezier(0.000, 0.995, 0.990, 1.000);
            -ms-transition: all 70ms cubic-bezier(0.000, 0.995, 0.990, 1.000);
             -o-transition: all 70ms cubic-bezier(0.000, 0.995, 0.990, 1.000);
                transition: all 70ms cubic-bezier(0.000, 0.995, 0.990, 1.000);
    }
    div.menu ul li a {
        color:#4a89dc;
        text-transform:uppercase;
        text-decoration:none;    
        letter-spacing:3px;            
    }

    div.menu li.animate{
        font-size:21px;
        opacity:1;
        -webkit-transition: all 150ms cubic-bezier(0.000, 0.995, 0.990, 1.000);
           -moz-transition: all 150ms cubic-bezier(0.000, 0.995, 0.990, 1.000);
            -ms-transition: all 150ms cubic-bezier(0.000, 0.995, 0.990, 1.000);
             -o-transition: all 150ms cubic-bezier(0.000, 0.995, 0.990, 1.000);
                transition: all 150ms cubic-bezier(0.000, 0.995, 0.990, 1.000);
    }
    div.menu li.animate:nth-of-type(1){    
        top:120px;
        transition-delay: 0.0s;    
    }
    div.menu li.animate:nth-of-type(2){
        top:190px;
        transition-delay: 0.03s;    
                
    }
    div.menu li.animate:nth-of-type(3){
        top:260px;
        transition-delay: 0.06s;        
        
    }
    div.menu li.animate:nth-of-type(4){
        top:330px;
        transition-delay: 0.09s;        
        
    }
    div.menu li.animate:nth-of-type(5){
        top:400px;
        transition-delay: 0.12s;        
        
    }
    div.menu li.animate:nth-of-type(6){
        top:470px;
        transition-delay: 0.15s;    
                
    }
    </style>

    <!--[if IE]>
        <script src="http://libs.useso.com/js/html5shiv/3.7/html5shiv.min.js"></script>
    <![endif]-->
</head>
<body>
    <div class="htmleaf-container">
        <div class="htmleaf-content">
            <div class="screen">
                <div class="navbar"></div>    
                <div class="circle"></div>
                <div class="menu">
                    <ul>
                        <li><a href="">About</a></li>
                        <li><a href="">Share</a></li>
                        <li><a href="">Activity</a></li>
                        <li><a href="">Settings</a></li>
                        <li><a href="">Contact</a></li>
                    </ul>
                </div>                        
                <div class="burger">
                    <div class="x"></div>
                    <div class="y"></div>
                    <div class="z"></div>
                </div>    
            </div>    
        </div>
    </div>
    
    <script src="http://libs.useso.com/js/jquery/1.11.0/jquery.min.js"></script>
    <script>
    if ('ontouchstart' in window) {
        var click = 'touchstart';
    } else {
        var click = 'click';
    }
    $('div.burger').on(click, function () {
        if (!$(this).hasClass('open')) {
            openMenu();
        } else {
            closeMenu();
        }
    });
    $('div.menu ul li a').on(click, function (e) {
        e.preventDefault();
        closeMenu();
    });
    function openMenu() {
        $('div.circle').addClass('expand');
        $('div.burger').addClass('open');
        $('div.x, div.y, div.z').addClass('collapse');
        $('.menu li').addClass('animate');
        setTimeout(function () {
            $('div.y').hide();
            $('div.x').addClass('rotate30');
            $('div.z').addClass('rotate150');
        }, 70);
        setTimeout(function () {
            $('div.x').addClass('rotate45');
            $('div.z').addClass('rotate135');
        }, 120);
    }
    function closeMenu() {
        $('div.burger').removeClass('open');
        $('div.x').removeClass('rotate45').addClass('rotate30');
        $('div.z').removeClass('rotate135').addClass('rotate150');
        $('div.circle').removeClass('expand');
        $('.menu li').removeClass('animate');
        setTimeout(function () {
            $('div.x').removeClass('rotate30');
            $('div.z').removeClass('rotate150');
        }, 50);
        setTimeout(function () {
            $('div.y').show();
            $('div.x, div.y, div.z').removeClass('collapse');
        }, 70);
    }
    </script>
</body>
</html>

转载于:https://www.cnblogs.com/wzzl/p/4909868.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
以下是一个简单的全屏页面切换特效的示例代码,可以用来实现网站的页面切换效果。代码中使用了 jQuery 和 CSS3 动画效果。 HTML 代码: ``` <div class="page-container"> <div class="page" id="page1"> <h1>Page 1</h1> <p>This is the first page.</p> </div> <div class="page" id="page2"> <h1>Page 2</h1> <p>This is the second page.</p> </div> <div class="page" id="page3"> <h1>Page 3</h1> <p>This is the third page.</p> </div> </div> ``` CSS 代码: ``` body { margin: 0; padding: 0; overflow: hidden; } .page-container { position: relative; width: 100%; height: 100%; } .page { position: absolute; top: 0; left: 0; width: 100%; height: 100%; display: none; } .page.active { display: block; } .page.in { animation: fadeIn 1s ease-in-out; } .page.out { animation: fadeOut 1s ease-in-out; } @keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } } @keyframes fadeOut { from { opacity: 1; } to { opacity: 0; } } ``` JavaScript 代码: ``` $(document).ready(function() { showPage($("#page1")); $(".nav-link").click(function(event) { event.preventDefault(); var page = $($(this).attr("href")); showPage(page); }); }); function showPage(page) { $(".page.active").addClass("out"); setTimeout(function() { $(".page.active").removeClass("active out"); page.addClass("in active"); }, 1000); } ``` 在这个示例中,页面通过一个包含多个子页面的容器来实现。每个子页面都是一个具有唯一标识符的 DIV 元素,并且通过 CSS 的绝对定位来覆盖整个容器。每个页面的默认状态是隐藏的,只有在它们被激活时才会显示。 当用户点击导航链接时,JavaScript 代码会获取目标页面的 ID 并使用 showPage() 函数来切换页面。该函数首先将当前活动页面标记为“out”,然后使用 CSS 动画效果淡出该页面。在动画完成后,该页面的“active”和“out”类都被删除,而目标页面则被标记为“in”和“active”,并使用 CSS 动画效果淡入。 此外,该代码还使用了 jQuery 和 CSS3 动画效果来实现页面切换效果。在这个示例中,我们使用了“fadeIn”和“fadeOut”动画,它们分别在页面淡入和淡出时播放。 以上就是一个简单的全屏页面切换特效的示例代码,你可以根据自己的需要进行修改和定制。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值