• 2级菜单


    <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <title>Document</title>
        <style type="text/css">
    
        *{margin:0;padding:0;border:0;font-family: "微软雅黑";}
        ul,ol{list-style:none;}
        a{text-decoration:none;color:#333;}
        em,i{font-style:normal;}
        body{background: #f2f2f2;}
    
        .clearfix:after{display:block; overflow:hidden; clear:both; height:0; visibility:hidden; content:".";}
        .fl{float:left;display:inline-block;}
        .fr{float:right;display:inline-block;}
        .div{ 330px;margin: 100px auto;background: #ffffff;padding-top:10px; padding-bottom: 10px;border:1px #dfdfdf solid;}
        .div h3{ 277px;height:43px;background: #f6f6f4;margin: 0 auto;border:1px #ebebeb solid;border-radius: 9px;font-size: 14px;color:#b1926f;line-height: 45px;padding-left: 34px;background:url(images/zakladka.png) center 0 no-repeat; }
    
        .div span{display: block;26px;height:37px;float:right;background: url(images/on1.png) center 0 no-repeat;cursor: pointer;}
    
        .div ul{ 270px;margin-left:40px; display: none;}
        .div ul li{ 260px;height: 26px;font-size: 12px;color: #bca94c;line-height:26px; cursor:pointer;}
    
        .div .spbg{background: url(images/on2.png) center 0 no-repeat;}
    
        .div .on{display: block;animation:on 0.6s ease;animation-fill-mode: forwards;}
        @keyframes on{
            0%{height: 0px;opacity: 0.2;}
            25%{opacity: opacity:0.5;}
            50%{opacity: 0.7}
            100%{height: 140px; opacity: 1;}
        }
    
        .div .off{display: block;animation:off 0.6s ease;animation-fill-mode: forwards;}
        @keyframes off{
            0%{height: 140px;}
            30%{opacity: 0.3;}
            100%{height: 0px; opacity: 0; visibility:hidden;}
        }
    
        </style>
    </head>
    <body>
    
    <div class="div"">
        <h3><span class="spbg"></span>Item 1</h3>
        <ul class="on">
            <li>Item without sunitms</li>
            <li>Item without sunitms</li>
            <li>Item without sunitms</li>
            <li>Item without sunitms</li>
            <li>Item without sunitms</li>
        </ul>
        <h3><span></span>Item 2</h3>
        <ul>
            <li>Item without sunitms</li>
            <li>Item without sunitms</li>
            <li>Item without sunitms</li>
            <li>Item without sunitms</li>
            <li>Item without sunitms</li>
        </ul>
        <h3 ><span></span>Item 3</h3>
        <ul>
            <li>Item without sunitms</li>
            <li>Item without sunitms</li>
            <li>Item without sunitms</li>
            <li>Item without sunitms</li>
            <li>Item without sunitms</li>
        </ul>
        <h3 >Item without sunitms</h3>
        <h3 >Item without sunitms</h3>
    </div>
    <script>
    var div = document.getElementsByClassName("div")[0];
    var uls = div.getElementsByTagName("ul");
    var lis = div.getElementsByTagName("li");
    var span = div.getElementsByTagName("span");
    var len = lis.length; 
    var liH = 26;
    var finish = false;
    
    for(i = 0; i < span.length; i++){
    
        span[i].index = i;
    
        span[i].onclick = function(){
            if(!finish){
                this.className = "spbg";
                uls[this.index].className = "on";
                finish = true;
            }else{
                this.className = "";
                uls[this.index].className = "off";
                        
                finish = false;
            }
            
        }
    }
    
    
    </script>
    
    </body>
    </html>

  • 相关阅读:
    PHP数组函数(5)
    python3-开发面试题(python)6.24基础篇(3)
    python3开发进阶-Django框架的ORM常用字段和参数
    python3-开发面试题(python)6.23基础篇(2)
    python3 中 and 和 or 运算规律
    python3开发进阶-Django框架中的ORM的常用操作的补充(F查询和Q查询,事务)
    python3-开发面试题(python)6.22基础篇(1)
    python3开发进阶-Django框架中的ORM的常用(增,删,改,查)操作
    python3-os模块中的os.walk(目录树生成器)
    python3开发进阶-Django框架的详解
  • 原文地址:https://www.cnblogs.com/dexin/p/6337017.html
Copyright © 2020-2023  润新知