• 子菜单下拉


    子菜单下拉

    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>无标题文档</title>
    <style type="text/css">
    *{ margin:0px auto; padding:0px;}
    #items{760px; height:50px;}
    .itema{ 150px; height:50px; background-color:#666; border-right:1px solid #000; float:left; color:#fff; text-align:center; line-height:50px; vertical-align:middle}
    .itema:hover{ cursor:pointer}
    .hid{ 0px; height:0px; float:left; position:relative; top:50px; left:-150px}
    .hid1{ 150px; height:50px; line-height:50px; vertical-align:middle; text-align:center; background-color:#0F0}
    </style>
    </head>
    
    <body>
     <div id="items">
         <div class="itema">产品详情</div>
        <div class="hid" style=" display:none">  //做一个0大小的div
            <div class="hid1">123</div>
            <div class="hid1">123</div>
            <div class="hid1">123</div>
        </div>
        <div class="itema">新闻中心</div>
        <div class="hid" style=" display:none">
            <div class="hid1">123</div>
            <div class="hid1">123</div>
            <div class="hid1">123</div>
        </div>
        <div class="itema">公司动态</div>
        <div class="hid" style=" display:none">
            <div class="hid1">123</div>
            <div class="hid1">123</div>
            <div class="hid1">123</div>
        </div>
        <div class="itema">关于我们</div>
        <div class="hid" style=" display:none">
            <div class="hid1">123</div>
            <div class="hid1">123</div>
            <div class="hid1">123</div>
        </div>
        <div class="itema">联系我们</div>
        <div class="hid" style=" display:none">
            <div class="hid1">123</div>
            <div class="hid1">123</div>
            <div class="hid1">123</div>
        </div>
     </div>
    </body>
    </html>
    <script type="text/javascript">
    var itema = document.getElementsByClassName("itema")
    for(var i=0;i<itema.length;i++)
    {
        itema[i].onmouseover = function()
        {
            this.nextSibling.nextSibling.style.display = "block";
        }
    }     //鼠标移上时,展开
    for(var i=0;i<itema.length;i++)
    {    itema[i].onmouseout = function(){
        this.nextSibling.nextSibling.style.display = "none";
        }
    }    //鼠标移出时,收回
    </script>

    效果图:

  • 相关阅读:
    Structured streaming
    streaming窗口操作
    scala伴生对象,apply()及单例
    storm集成kafka
    solr简易安装配置
    拦路雨偏似雪花,饮泣的你冻吗?--稍瑞,我是关键字过滤器
    我存在,你深深的循环里--从反射看JSON死循环
    ueditor:原谅我这一生不羁放纵爱独特
    或许你不知道(2):LinkedList
    自定义负载均衡
  • 原文地址:https://www.cnblogs.com/Whitehat/p/8025666.html
Copyright © 2020-2023  润新知