Blogger Information
Blog 8
fans 0
comment 0
visits 7036
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
jquery 二级导航
A云海的博客
Original
915 people have browsed it


实例

<!DOCTYPE html>
<html lang="en">
<head>
   <meta charset="UTF-8">
   <title>导航案例</title>
   <link rel="stylesheet" href="/static/css/daohang.css">
   <script type="text/javascript" src="/static/js/jquery-3.3.1.min.js"></script>
</head>

   <style type="text/css">
        *{margin: 0;padding: 0;}
       #bg{background: red;width: 100%;height: 35px;}
       nav{height: 35px;width: 1000px;margin: 0 auto;}
       nav ul li{list-style:none;float: left;}
       nav ul li a{ text-decoration: none;display: block;width: 130px;line-height: 35px;text-align: center;
                 color:white;font-fimily:微软雅黑;}
       nav ul li ul li{float: none}
       nav ul li ul li a{color:black}
   </style>
<script type="text/javascript">
   $(document).ready(function () {
       $('li>ul').hide();
       $('.nav_one').mouseover(function () {
           $('.one').show();
       });
       $('.nav_one').mouseleave(function () {
           $('.one').hide();
       });
       $('.nav_two').mouseover(function () {
           $('.nav_two ul').show(1000);
       });
       $('.nav_two').mouseleave(function () {
           $('.nav_two ul').hide(3000);
       });
   })
</script>
<body>
<div id="bg">
<nav>
  <ul>
      <li class="nav_one"><a href="#">一级导航</a>
        <ul class="one">
            <li><a href="#">二级导航</a></li>
            <li><a href="#">二级导航</a></li>
            <li><a href="#">二级导航</a></li>
            <li><a href="#">二级导航</a></li>
        </ul>
        </li>
        <li class="nav_two"><a href="#">一级导航</a>
            <ul>
                <li><a href="#">二级导航</a></li>
                <li><a href="#">二级导航</a></li>
                <li><a href="#">二级导航</a></li>
            </ul>
        </li>
        <li><a href="#">一级导航</a>
            <ul>
                <li><a href="#">二级导航</a></li>
                <li><a href="#">二级导航</a></li>
                <li><a href="#">二级导航</a></li>
                <li><a href="#">二级导航</a></li>
            </ul>
        </li>
        <li><a href="#">一级导航</a>
            <ul>
                <li><a href="#">二级导航</a></li>
                <li><a href="#">二级导航</a></li>
                <li><a href="#">二级导航</a></li>
            </ul>
        </li>
        <li><a href="#">一级导航</a>
            <ul>
                <li><a href="#">二级导航</a></li>
                <li><a href="#">二级导航</a></li>
                <li><a href="#">二级导航</a></li>
                <li><a href="#">二级导航</a></li>
                <li><a href="#">二级导航</a></li>
            </ul>
        </li>
        <li><a href="#">一级导航</a>
           <ul>
                <li><a href="#">二级导航</a></li>
                <li><a href="#">二级导航</a></li>
                <li><a href="#">二级导航</a></li>
                <li><a href="#">二级导航</a></li>
            </ul>
        </li>

   </ul>
</nav>
</div>
</body>
</html>

运行实例 »

点击 "运行实例" 按钮查看在线实例


Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post