导航菜单

bootstrap多级导航菜单特效

阿里云

这是一款基于 Bootstrap 和 Bootsnav 的多级导航菜单。该多级导航菜单通过简单的 CSS 代码来对菜单进行美化,制作鼠标滑过的动画效果。

使用方法:

在页面中引入 bootstrap 相关文件和 bootsnav 相关文件。

也想出现在这里?联系我们
创客主机
  1. <link href="css/bootstrap.min.css" rel="stylesheet">
  2. <link rel="stylesheet" href="css/bootsnav.css"/>
  3. <script src="path/to/jquery.min.js"></script>
  4. <script type="text/javascript" src="js/bootstrap.min.js"></script>
  5. <script type="text/javascript" src="js/bootsnav.js"></script>

HTML 结构:

该 Bootstrap 多级导航菜单的基本 HTML 结构如下:

  1. <div class="container">
  2.     <div class="row">
  3.         <div class="col-md-12">
  4.             <nav class="navbar navbar-default navbar-mobile bootsnav">
  5.                 <div class="navbar-header">
  6.                     <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#navbar-menu">
  7.                         <i class="fa fa-bars"></i>
  8.                     </button>
  9.                 </div>
  10.                 <div class="collapse navbar-collapse" id="navbar-menu">
  11.                     <ul class="nav navbar-nav" data-in="fadeInDown" data-out="fadeOutUp">
  12.                         <li alt="HOME"><a href="#">Home</a></li>
  13.                         <li alt="ABOUT US"><a href="#">About Us</a></li>
  14.                         <li class="dropdown" alt="SHORTCODES">
  15.                             <a href="#" class="dropdown-toggle" data-toggle="dropdown">Shortcodes</a>
  16.                             <ul class="dropdown-menu">
  17.                                 <li><a href="#">Custom Menu</a></li>
  18.                                 <li><a href="#">Custom Menu</a></li>
  19.                                 <li class="dropdown">
  20.                                     <a href="#" class="dropdown-toggle" data-toggle="dropdown" >Sub Menu</a>
  21.                                     <ul class="dropdown-menu">
  22.                                         <li><a href="#">Custom Menu</a></li>
  23.                                         <li><a href="#">Custom Menu</a></li>
  24.                                         <li class="dropdown">
  25.                                             <a href="#" class="dropdown-toggle" data-toggle="dropdown" >Sub Menu</a>
  26.                                             <ul class="dropdown-menu multi-dropdown">
  27.                                                 <li><a href="#">Custom Menu</a></li>
  28.                                                 <li><a href="#">Custom Menu</a></li>
  29.                                                 <li><a href="#">Custom Menu</a></li>
  30.                                                 <li><a href="#">Custom Menu</a></li>
  31.                                             </ul>
  32.                                         </li>
  33.                                         <li><a href="#">Custom Menu</a></li>
  34.                                     </ul>
  35.                                 </li>
  36.                                 <li><a href="#">Custom Menu</a></li>
  37.                                 <li><a href="#">Custom Menu</a></li>
  38.                                 <li><a href="#">Custom Menu</a></li>
  39.                                 <li><a href="#">Custom Menu</a></li>
  40.                             </ul>
  41.                         </li>
  42.                         <li class="dropdown" alt="PAGES">
  43.                             <a href="#" class="dropdown-toggle" data-toggle="dropdown">Pages</a>
  44.                             <ul class="dropdown-menu">
  45.                                 <li><a href="#">Custom Menu</a></li>
  46.                                 <li><a href="#">Custom Menu</a></li>
  47.                                 <li class="dropdown">
  48.                                     <a href="#" class="dropdown-toggle" data-toggle="dropdown">Sub Menu</a>
  49.                                     <ul class="dropdown-menu">
  50.                                         <li><a href="#">Custom Menu</a></li>
  51.                                         <li><a href="#">Custom Menu</a></li>
  52.                                         <li class="dropdown">
  53.                                             <a href="#" class="dropdown-toggle" data-toggle="dropdown">Sub Menu</a>
  54.                                             <ul class="dropdown-menu multi-dropdown">
  55.                                                 <li><a href="#">Custom Menu</a></li>
  56.                                                 <li><a href="#">Custom Menu</a></li>
  57.                                                 <li><a href="#">Custom Menu</a></li>
  58.                                                 <li><a href="#">Custom Menu</a></li>
  59.                                             </ul>
  60.                                         </li>
  61.                                         <li><a href="#">Custom Menu</a></li>
  62.                                     </ul>
  63.                                 </li>
  64.                                 <li><a href="#">Custom Menu</a></li>
  65.                                 <li><a href="#">Custom Menu</a></li>
  66.                                 <li><a href="#">Custom Menu</a></li>
  67.                                 <li><a href="#">Custom Menu</a></li>
  68.                             </ul>
  69.                         </li>
  70.                         <li alt="PORTFOLIO"><a href="#">Portfolio</a></li>
  71.                         <li alt="CONTACT US"><a href="#">Contact Us</a></li>
  72.                     </ul>
  73.                 </div>
  74.             </nav>
  75.         </div>
  76.     </div>
  77. </div>

CSS 样式:

为该 Bootstrap 多级导航菜单添加以下的 CSS 样式:

  1. nav.navbar.bootsnav{
  2.     border: none;
  3.     background: none;
  4.     margin-bottom: 150px;
  5. }
  6. nav.navbar.bootsnav ul.nav > li{
  7.     margin-right: 10px;
  8. }
  9. nav.navbar.bootsnav ul.nav > li:before{
  10.     content: attr(alt);
  11.     padding: 15px;
  12.     font-size: 14px;
  13.     font-weight: 600;
  14.     color: #fff;
  15.     opacity: 0;
  16.     overflow: hidden;
  17.     position: absolute;
  18.     top: 0;
  19.     left: 0;
  20.     transform: scale(1.2);
  21.     transition: all 0.3s ease 0s;
  22. }
  23. nav.navbar.bootsnav ul.nav > li:hover:before{
  24.     transform: scale(1);
  25.     opacity: 1;
  26. }
  27. nav.navbar.bootsnav ul.nav > li > a{
  28.     padding: 15px;
  29.     margin: 0;
  30.     /*color: rgba(0, 0, 0, 0.4);*/
  31.     color: #D5D6E2;
  32.     text-transform: uppercase;
  33.     z-index: 1;
  34.     transition: all 0.5s ease 0s;
  35. }
  36. nav.navbar.bootsnav ul.nav > li.dropdown > a{
  37.     padding: 15px 30px 15px 15px;
  38. }
  39. nav.navbar.bootsnav ul.nav > li > a:hover,
  40. nav.navbar.bootsnav ul.nav > li.on > a{ color: #fff; }
  41. nav.navbar.bootsnav ul.nav > li.dropdown > a.dropdown-toggle:after{
  42.     position: absolute;
  43.     margin: 0 0 0 7px;
  44. }
  45. nav.navbar.bootsnav ul.nav > li.dropdown > ul{
  46.     top: 120%;
  47.     transition: all 0.8s ease 0s;
  48. }
  49. nav.navbar.bootsnav ul.nav > li.dropdown.on > ul{
  50.     top: 100%;
  51. }
  52. .dropdown-menu.multi-dropdown{
  53.     position: absolute;
  54.     left: -100% !important;
  55. }
  56. nav.navbar.bootsnav li.dropdown ul.dropdown-menu{
  57.     box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
  58.     border: none;
  59. }
  60. @media only screen and (max-width:990px){
  61.     .dropdown-menu.multi-dropdown{ left: 0 !important; }
  62.     nav.navbar.bootsnav .navbar-toggle{
  63.         background: none;
  64.         color: #fff;
  65.     }
  66.     nav.navbar.bootsnav ul.nav > li{
  67.         margin-right: 0;
  68.     }
  69.     nav.navbar.bootsnav ul.nav > li:before{
  70.         width: 100%;
  71.         font-weight: normal;
  72.         color: #555;
  73.     }
  74.     nav.navbar.bootsnav ul.nav > li > a{
  75.         color: #333 !important;
  76.         border-top: none;
  77.     }
  78.     nav.navbar.bootsnav ul.nav > li > a:hover{
  79.         color: #333;
  80.     }
  81.     nav.navbar.bootsnav ul.nav > li.dropdown > ul{ top: 100%; }
  82. }

bootstrap 多级导航菜单特效

已有 660 人购买
查看演示升级 VIP立刻购买

演示地址 下载地址
收藏
(2)

发表回复

热销模板

Ashade - 作品展示摄影相册WordPress汉化主题
LensNews

本站承接 WordPress / PbootCMS / DedeCMS 等
系统建站、仿站、开发、定制等业务!