导航菜单

基于bootsnav的响应式导航菜单特效

面包多

基于bootsnav的响应式导航菜单特效-创客云
这是一款基于 bootsnav 的响应式导航菜单特效。该导航菜单包含了多级菜单,大型菜单,并且附带有炫酷的动画特效,非常实用。

使用方法

在页面中引入下面的文件。

也想出现在这里?联系我们
WordPress 主题
  1. <link rel="stylesheet" type="text/css" href="css/bootstrap.min.css" />
  2. <link rel="stylesheet" href="css/fontawesome-all.min.css">
  3. <link rel="stylesheet" href="css/bootsnav.css"/>
  4. <script src="js/jquery-1.11.0.min.js" type="text/javascript"></script>
  5. <script src="js/bootstrap.min.js" type="text/javascript"></script>
  6. <script type="text/javascript" src="js/bootsnav.js"></script>

HTML 结构

导航菜单的 HTML 结果如下:

  1. <div class="demo">
  2.     <div class="container">
  3.         <div class="row">
  4.             <div class="col-md-12">
  5.                 <nav class="navbar navbar-default navbar-mobile bootsnav on">
  6.                     <div class="navbar-header">
  7.                         <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#navbar-menu">
  8.                             <i class="fa fa-bars"></i>
  9.                         </button>
  10.                     </div>
  11.                     <div class="collapse navbar-collapse" id="navbar-menu">
  12.                         <ul class="nav navbar-nav" data-in="fadeInDown" data-out="fadeOutUp">
  13.                             <li class="active"><a href="#" data-hover="Home">Home <span data-hover="Home"></span></a></li>
  14.                             <li><a href="#" data-hover="About">About <span data-hover="About"></span></a></li>
  15.                             <li class="dropdown">
  16.                                 <a href="#" class="dropdown-toggle" data-toggle="dropdown" data-hover="Shortcodes">Shortcodes <span data-hover="Shortcodes"></span></a>
  17.                                 <ul class="dropdown-menu animated">
  18.                                     <li><a href="#">Custom Menu</a></li>
  19.                                     <li><a href="#">Custom Menu</a></li>
  20.                                     <li class="dropdown">
  21.                                         <a href="#" class="dropdown-toggle" data-toggle="dropdown">Sub Menu</a>
  22.                                         <ul class="dropdown-menu animated">
  23.                                             <li><a href="#">Custom Menu</a></li>
  24.                                             <li><a href="#">Custom Menu</a></li>
  25.                                             <li class="dropdown">
  26.                                                 <a href="#" class="dropdown-toggle" data-toggle="dropdown">Sub Menu</a>
  27.                                                 <ul class="dropdown-menu multi-dropdown animated">
  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.                                                     <li><a href="#">Custom Menu</a></li>
  32.                                                 </ul>
  33.                                             </li>
  34.                                             <li><a href="#">Custom Menu</a></li>
  35.                                         </ul>
  36.                                     </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.                                     <li><a href="#">Custom Menu</a></li>
  41.                                 </ul>
  42.                             </li>
  43.                             <li class="dropdown">
  44.                                 <a href="#" class="dropdown-toggle" data-toggle="dropdown" data-hover="Pages">Pages <span data-hover="Pages"></span></a>
  45.                                 <ul class="dropdown-menu animated">
  46.                                     <li><a href="#">Custom Menu</a></li>
  47.                                     <li><a href="#">Custom Menu</a></li>
  48.                                     <li class="dropdown">
  49.                                         <a href="#" class="dropdown-toggle" data-toggle="dropdown">Sub Menu</a>
  50.                                         <ul class="dropdown-menu animated">
  51.                                             <li><a href="#">Custom Menu</a></li>
  52.                                             <li><a href="#">Custom Menu</a></li>
  53.                                             <li class="dropdown">
  54.                                                 <a href="#" class="dropdown-toggle" data-toggle="dropdown">Sub Menu</a>
  55.                                                 <ul class="dropdown-menu multi-dropdown animated">
  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.                                                     <li><a href="#">Custom Menu</a></li>
  60.                                                 </ul>
  61.                                             </li>
  62.                                             <li><a href="#">Custom Menu</a></li>
  63.                                         </ul>
  64.                                     </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.                                     <li><a href="#">Custom Menu</a></li>
  69.                                 </ul>
  70.                             </li>
  71.                             <li><a href="#" data-hover="Portfolio">Portfolio <span data-hover="Portfolio"></span></a></li>
  72.                             <li class="dropdown megamenu-fw">
  73.                                 <a href="#" class="dropdown-toggle" data-toggle="dropdown" data-hover="Megamenu">Megamenu <span data-hover="Megamenu"></span></a>
  74.                                 <ul class="dropdown-menu megamenu-content animated" role="menu">
  75.                                     <li>
  76.                                         <div class="row">
  77.                                             <div class="col-menu col-md-3">
  78.                                                 <h6 class="title">Title Menu One</h6>
  79.                                                 <div class="content">
  80.                                                     <ul class="menu-col">
  81.                                                         <li><a href="#">Custom Menu</a></li>
  82.                                                         <li><a href="#">Custom Menu</a></li>
  83.                                                         <li><a href="#">Custom Menu</a></li>
  84.                                                         <li><a href="#">Custom Menu</a></li>
  85.                                                         <li><a href="#">Custom Menu</a></li>
  86.                                                     </ul>
  87.                                                 </div>
  88.                                             </div><!-- end col-3 -->
  89.                                             <div class="col-menu col-md-3">
  90.                                                 <h6 class="title">Title Menu Two</h6>
  91.                                                 <div class="content">
  92.                                                     <ul class="menu-col">
  93.                                                         <li><a href="#">Custom Menu</a></li>
  94.                                                         <li><a href="#">Custom Menu</a></li>
  95.                                                         <li><a href="#">Custom Menu</a></li>
  96.                                                         <li><a href="#">Custom Menu</a></li>
  97.                                                         <li><a href="#">Custom Menu</a></li>
  98.                                                     </ul>
  99.                                                 </div>
  100.                                             </div><!-- end col-3 -->
  101.                                             <div class="col-menu col-md-3">
  102.                                                 <h6 class="title">Title Menu Three</h6>
  103.                                                 <div class="content">
  104.                                                     <ul class="menu-col">
  105.                                                         <li><a href="#">Custom Menu</a></li>
  106.                                                         <li><a href="#">Custom Menu</a></li>
  107.                                                         <li><a href="#">Custom Menu</a></li>
  108.                                                         <li><a href="#">Custom Menu</a></li>
  109.                                                         <li><a href="#">Custom Menu</a></li>
  110.                                                     </ul>
  111.                                                 </div>
  112.                                             </div>
  113.                                             <div class="col-menu col-md-3">
  114.                                                 <h6 class="title">Title Menu Four</h6>
  115.                                                 <div class="content">
  116.                                                     <ul class="menu-col">
  117.                                                         <li><a href="#">Custom Menu</a></li>
  118.                                                         <li><a href="#">Custom Menu</a></li>
  119.                                                         <li><a href="#">Custom Menu</a></li>
  120.                                                         <li><a href="#">Custom Menu</a></li>
  121.                                                         <li><a href="#">Custom Menu</a></li>
  122.                                                     </ul>
  123.                                                 </div>
  124.                                             </div><!-- end col-3 -->
  125.                                         </div><!-- end row -->
  126.                                     </li>
  127.                                 </ul>
  128.                             </li>
  129.                             <li><a href="#" data-hover="Contact">Contact <span data-hover="Contact"></span></a></li>
  130.                         </ul>
  131.                     </div>
  132.                 </nav>
  133.             </div>
  134.         </div>
  135.     </div>
  136. </div>

CSS 样式

然后为导航菜单添加下面的 CSS 样式。

  1. nav.navbar.bootsnav{
  2.     background: none;
  3.     font-family: 'Sarabun', sans-serif;
  4.     margin-bottom: 150px;
  5.     border: none;
  6. }
  7. nav.navbar.bootsnav ul.nav > li{ margin-right: 20px; }
  8. nav.navbar.bootsnav ul.nav > li > a{
  9.     color: #fff;
  10.     background-color: transparent;
  11.     font-size: 15px;
  12.     font-weight: 600;
  13.     text-transform: uppercase;
  14.     padding: 10px 15px;
  15.     border-radius: 0;
  16.     overflow: hidden;
  17.     position: relative;
  18.     transition: all .5s ease;
  19.     z-index: 1;
  20. }
  21. nav.navbar.bootsnav ul.nav > li.dropdown > a{ padding: 10px 30px 10px 15px; }
  22. nav.navbar.bootsnav ul.nav > li.active > a,
  23. nav.navbar.bootsnav ul.nav > li.active > a:hover,
  24. nav.navbar.bootsnav ul.nav > li > a:hover,
  25. nav.navbar.bootsnav ul.nav > li.on > a{
  26.     color: #fff;
  27.     background: transparent !important;
  28.     border-color: transparent;
  29. }
  30. nav.navbar.bootsnav ul.nav > li > a > span:before,
  31. nav.navbar.bootsnav ul.nav > li > a > span:after{
  32.     content: "";
  33.     background-color: rgba(255,255,255,0.5);
  34.     width: 50%;
  35.     height: 100%;
  36.     position: absolute;
  37.     left: -100%;
  38.     top: 0;
  39.     transition: all 0.3s ease 0s;
  40. }
  41. nav.navbar.bootsnav ul.nav > li > a > span:after{
  42.     width: 100%;
  43.     height: 2px;
  44.     top: 50%;
  45.     transform: translateY(-50%);
  46.     left: 100%;
  47.     transition: all 0.3s ease 0.1s;
  48. }
  49. nav.navbar.bootsnav ul.nav > li:hover > a > span:before,
  50. nav.navbar.bootsnav ul.nav > li.active > a > span:before{
  51.     left: 100%;
  52. }
  53. nav.navbar.bootsnav ul.nav > li:hover > a > span:after,
  54. nav.navbar.bootsnav ul.nav > li.active > a > span:after{
  55.     left:0;
  56. }
  57. nav.navbar.bootsnav li.dropdown ul.dropdown-menu li a{ color: #fff !important; }
  58. nav.navbar.bootsnav li.dropdown ul.dropdown-menu.megamenu-content li a:hover,
  59. nav.navbar.bootsnav li.dropdown ul.dropdown-menu li a:hover,
  60. nav.navbar.bootsnav li.dropdown ul.dropdown-menu li a.dropdown-toggle:active,
  61. nav.navbar ul.nav li.dropdown.on ul.dropdown-menu li.dropdown.on > a{
  62.     background: #fff !important;
  63.     color: #1775e8 !important;
  64.     box-shadow: 0 0 8px #fff inset;
  65. }
  66. nav.navbar.bootsnav ul.nav > li.dropdown > a.dropdown-toggle:after{
  67.     position: absolute;
  68.     top: 10px;
  69.     right: 10px;
  70.     margin: 0 0 0 7px;
  71. }
  72. nav.navbar.bootsnav ul.nav > li.dropdown > ul{
  73.     top: 100%;
  74.     transition: all 0.8s ease 0s;
  75. }
  76. nav.navbar.bootsnav ul.nav > li.dropdown.on > ul{ top: 120%; }
  77. .dropdown-menu.multi-dropdown{
  78.     position: absolute;
  79.     left: -100% !important;
  80. }
  81. nav.navbar.bootsnav li.dropdown ul.dropdown-menu{
  82.     box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
  83.     background-color: #1775e8;
  84.     border: none;
  85. }
  86. nav.navbar.bootsnav li.dropdown ul.dropdown-menu.megamenu-content li{ font-size: 14px; }
  87. nav.navbar.bootsnav li.dropdown ul.dropdown-menu.megamenu-content .menu-col li a{ padding-left: 10px; }
  88. nav.navbar.bootsnav li.dropdown ul.dropdown-menu.megamenu-content .title{
  89.     color: #fff;
  90.     font-size: 16px;
  91.     font-weight: bold;
  92. }
  93. @media only screen and (max-width:990px){
  94.     .dropdown-menu.multi-dropdown{ left: 0 !important; }
  95.     nav.navbar.bootsnav .navbar-toggle{
  96.         color: #fff;
  97.         background: transparent !important;
  98.     }
  99.     nav.navbar.bootsnav.navbar-mobile .navbar-collapse{ background-color: #1775e8; }
  100.     nav.navbar.bootsnav ul.nav>li{ margin: 5px auto 15px; }
  101.     nav.navbar.bootsnav.navbar-mobile ul.nav>li>a{
  102.         color: #fff;
  103.         text-align: center;
  104.         padding: 10px 15px;
  105.         border: none;
  106.     }
  107.     nav.navbar.bootsnav ul.nav>li.dropdown>a{ padding: 10px 10px 10px 17px; }
  108.     nav.navbar.bootsnav ul.nav>li.active>a,
  109.     nav.navbar.bootsnav ul.nav>li>a:hover,
  110.     nav.navbar.bootsnav ul.nav>li.on>a{
  111.         color: #fff;
  112.     }
  113.     nav.navbar.bootsnav ul.nav li.dropdown ul.dropdown-menu>li>a{
  114.         padding-left: 10px;
  115.         border-bottom-color: none;
  116.     }
  117.     nav.navbar.bootsnav ul.nav>li.dropdown>ul{ top: 100%; }
  118.     nav.navbar.bootsnav li.dropdown ul.dropdown-menu.megamenu-content .title{
  119.         color: #fff;
  120.         font-size: 14px;
  121.         font-weight: normal;
  122.         padding-left: 10px;
  123.     }
  124. }
(0)

本文由 创客云 作者:PetitQ 发表,转载请注明来源!

阿里云

热评文章

发表评论

精彩推荐

Supro - 极简电商WordPress汉化主题

钻石珠宝奢侈品DedeCMS织梦模板

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

Hi, 如果您有主题插件代购(30-600元)汉化等建站相关业务,可以 跟我联系 哦!
欢迎投稿
嘿,欢迎咨询!