zoukankan      html  css  js  c++  java
  • css: Bootstrap 4 or 3 Multilevel Dropdown Menu

    <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="utf-8">
    <meta name="Keywords" content="塗聚文,捷為工作室,万年历,万年历查询,黄历,黄历查询,塗聚文,捷為工作室" />
    <meta name="Description" content="塗聚文,捷為工作室,信息流,物流,人力资源流,资本流的系统解决方案的开发与设计. " />
    <meta name="author" content="geovindu,塗聚文,Geovin Du" />
        <meta name="robots" content="noindex, nofollow">
        <title>Bootstrap multi level navigation menu | multi level dropdown menu with responsive - geovindu.com</title>
            <meta name="viewport" content="width=device-width, initial-scale=1">
        <link href="js/bootstrap.min3.3.0.css" rel="stylesheet" id="bootstrap-css">
        <style type="text/css">
        	@import url('https://fonts.googleapis.com/css?family=Roboto');
    a:hover,
    a:focus {
        text-decoration: none;
        outline: none;
    }
    body{font-family: 'Roboto', sans-serif;}
    /*
    1.1 Header Area
    ***************************************************/
    /*Bootstrap Reset*/
    .navbar-nav > li > a {
        padding-top: 0;
        padding-bottom: 0;
    }
    .mainmenu {
        background-color: transparent;
        border-color: transparent;
        margin-bottom: 0;
    	border: 0px !important;
    }
    .navbar-nav > li:last-child > a {
        padding-right: 0px;
        margin-right: 0px;
    }
    .dropdown-menu {
        padding: 0px 0; 
        margin: 0 0 0; 
        border: 0px solid transition !important;
    	border: 0px solid rgba(0,0,0,.15);	
    	border-radius: 0px;
        -webkit-box-shadow: none !important;
        box-shadow: none !important;
    
    }
    /*=-====Main Menu=====*/
    .navbar-nav .open .dropdown-menu > li > a {padding: 16px 15px 16px 25px;
    }
    .header_bottom { background: #0071ba }
    .header_area .header_bottom .mainmenu a , .navbar-default .navbar-nav > li > a {
        color: #fff;
        font-size: 16px;
        text-transform: capitalize;
        padding: 16px 15px;
    	font-family: 'Roboto', sans-serif;
    }
    .header_area .mainmenu .active a,
    .header_area .mainmenu .active a:focus,
    .header_area .mainmenu .active a:hover,
    .header_area .mainmenu li a:hover,
    .header_area .mainmenu li a:focus ,
    .navbar-default .navbar-nav>.open>a, .navbar-default .navbar-nav>.open>a:focus, .navbar-default .navbar-nav>.open>a:hover{
        color: #0071ba;
        background: #54c6d4;
        outline: 0;
    }
    /*-----./ Main Menu-----*/
    
    .navbar-default .navbar-toggle { border-color: #fff } /*Toggle Button*/
    .navbar-default .navbar-toggle .icon-bar { background-color: #fff } /*Toggle Button*/
    
    /*==========Sub Menu=v==========*/
    .mainmenu .collapse ul > li:hover > a{background: #54c6d4;}
    .mainmenu .collapse ul ul > li:hover > a, .navbar-default .navbar-nav .open .dropdown-menu > li > a:focus, .navbar-default .navbar-nav .open .dropdown-menu > li > a:hover{background: #CBEAF0;}
    .mainmenu .collapse ul ul ul > li:hover > a{background: #CBEAF0;}
    
    .mainmenu .collapse ul ul, .mainmenu .collapse ul ul.dropdown-menu{background:#98D7E1;}
    .mainmenu .collapse ul ul ul, .mainmenu .collapse ul ul ul.dropdown-menu{background:#0a1464}
    .mainmenu .collapse ul ul ul ul, .mainmenu .collapse ul ul ul ul.dropdown-menu{background:#e4eeb8}
    
    /******************************Drop-down menu work on hover**********************************/
    .mainmenu{background: none;border: 0 solid;margin: 0;padding: 0;min-height:20px}
    @media only screen and (min- 767px) {
    .mainmenu .collapse ul li{position:relative;}
    .mainmenu .collapse ul li:hover> ul{display:block}
    .mainmenu .collapse ul ul{position:absolute;top:100%;left:0;min-250px;display:none}
    /*******/
    .mainmenu .collapse ul ul li{position:relative}
    .mainmenu .collapse ul ul li:hover> ul{display:block}
    .mainmenu .collapse ul ul ul{position:absolute;top:0;left:100%;min-250px;display:none}
    /*******/
    .mainmenu .collapse ul ul ul li{position:relative}
    .mainmenu .collapse ul ul ul li:hover ul{display:block}
    .mainmenu .collapse ul ul ul ul{position:absolute;top:0;left:-100%;min-250px;display:none;z-index:1}
    
    }
        </style>
        <script src="js/jquery-1.11.1.min.js"></script>
        <script src="js/bootstrap.min3.3.0.js"></script>
        <script type="text/javascript">
            window.alert = function(){};
            var defaultCSS = document.getElementById('bootstrap-css');
            function changeCSS(css){
                if(css) $('head > link').filter(':first').replaceWith('<link rel="stylesheet" href="'+ css +'" type="text/css" />'); 
                else $('head > link').filter(':first').replaceWith(defaultCSS); 
            }
            $( document ).ready(function() {
              var iframe_height = parseInt($('html').height()); 
              window.parent.postMessage( iframe_height, 'https://bootsnipp.com');
            });
        </script>
    </head>
    <body>
            <div class="text-center"><h2>Bootstrap multi level navigation menu | multi level dropdown menu <br> with responsive in Bootstrap 3</h2></div>
        <div id="header-area" class="header_area">
            <div class="header_bottom">
                <div class="container">
                    <div class="row">
                        <nav role="navigation" class="navbar navbar-default mainmenu">
                    <!-- Brand and toggle get grouped for better mobile display -->
                            <div class="navbar-header">
                                <button type="button" data-target="#navbarCollapse" data-toggle="collapse" class="navbar-toggle">
                                    <span class="sr-only">Toggle navigation</span>
                                    <span class="icon-bar"></span>
                                    <span class="icon-bar"></span>
                                    <span class="icon-bar"></span>
                                </button>
                            </div>
                            <!-- Collection of nav links and other content for toggling -->
                            <div id="navbarCollapse" class="collapse navbar-collapse">
                                <ul id="fresponsive" class="nav navbar-nav dropdown">
                                    <li class="active"><a href="#">Home</a></li>
                                    <li><a href="#">About</a></li>
                                    <li><a href="#">service</a></li>
                                    <li class="dropdown"><a data-toggle="dropdown" class="dropdown-toggle">Submenu 1<span class="caret"></span></a>
    									<ul class="dropdown-menu">
    										<li><a href="#">Lorem ipsum</a></li>
    										<li>
    											<a href="#" data-toggle="dropdown" class="dropdown-toggle">Submenu 2<span class="caret"></span></a>
    											<ul class="dropdown-menu">
    												<li><a href="#">Lorem ipsum</a></li>
    												<li><a href="#">Lorem ipsum</a></li>
    												<li>
    													<a href="#" data-toggle="dropdown" class="dropdown-toggle">Submenu 3<span class="caret"></span></a>
    													<ul class="dropdown-menu">
    														<li><a href="#">Lorem ipsum</a></li>
    														<li><a href="#">Lorem ipsum</a></li>
    													</ul>
    											</li>
    											</ul>
    										</li>
    									</ul>
    								</li>
                                    <li><a href="#Download">lorem ipsum</a></li>        
                                </ul>
                            </div>
                        </nav>
                    </div> 
                </div>            
            </div><!-- /.header_bottom -->
          
        </div>
    	<br>
    	<div class="text-center">
    	<img src="http://dusystem.com/add/bs2.png" alt="multi level dropdown menu" />
    	
        </div>
    	<script type="text/javascript">
    	(function($){
    	$(document).ready(function(){
    		$('ul.dropdown-menu [data-toggle=dropdown]').on('click', function(event) {
    			event.preventDefault(); 
    			event.stopPropagation(); 
    			$(this).parent().siblings().removeClass('open');
    			$(this).parent().toggleClass('open');
    		});
    	});
    })(jQuery);	</script>
    </body>
    </html>
    

      

    <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="utf-8">
        <meta name="robots" content="noindex, nofollow">
    <meta name="Keywords" content="塗聚文,捷為工作室,万年历,万年历查询,黄历,黄历查询,塗聚文,捷為工作室" />
    <meta name="Description" content="塗聚文,捷為工作室,信息流,物流,人力资源流,资本流的系统解决方案的开发与设计. " />
    <meta name="author" content="geovindu,塗聚文,Geovin Du" />
        <title>Bootstrap 4 Multilevel Dropdown Menu - geovindu.com</title>
            <meta name="viewport" content="width=device-width, initial-scale=1">
        <link href="js/bootstrap.min4.1.1.css" rel="stylesheet" id="bootstrap-css">
        <style type="text/css">
        .menu-area{background: #d61a5e}
    .dropdown-menu{padding:0;margin:0;border:0 solid transition!important;border:0 solid rgba(0,0,0,.15);border-radius:0;-webkit-box-shadow:none!important;box-shadow:none!important}
    .mainmenu a, .navbar-default .navbar-nav > li > a, .mainmenu ul li a , .navbar-expand-lg .navbar-nav .nav-link{color:#fff;font-size:16px;text-transform:capitalize;padding:16px 15px;font-family:'Roboto',sans-serif;display: block !important;}
    .mainmenu .active a,.mainmenu .active a:focus,.mainmenu .active a:hover,.mainmenu li a:hover,.mainmenu li a:focus ,.navbar-default .navbar-nav>.show>a, .navbar-default .navbar-nav>.show>a:focus, .navbar-default .navbar-nav>.show>a:hover{color: #fff;background: #4CAF50;outline: 0;}
    /*==========Sub Menu=v==========*/
    .mainmenu .collapse ul > li:hover > a{background: #4CAF50;}
    .mainmenu .collapse ul ul > li:hover > a, .navbar-default .navbar-nav .show .dropdown-menu > li > a:focus, .navbar-default .navbar-nav .show .dropdown-menu > li > a:hover{background: #4CAF50;}
    .mainmenu .collapse ul ul ul > li:hover > a{background: #4CAF50;}
    
    .mainmenu .collapse ul ul, .mainmenu .collapse ul ul.dropdown-menu{background:#1565C0;}
    .mainmenu .collapse ul ul ul, .mainmenu .collapse ul ul ul.dropdown-menu{background:#1E88E5}
    .mainmenu .collapse ul ul ul ul, .mainmenu .collapse ul ul ul ul.dropdown-menu{background:#64B5F6}
    
    /******************************Drop-down menu work on hover**********************************/
    .mainmenu{background: none;border: 0 solid;margin: 0;padding: 0;min-height:20px; 100%;}
    @media only screen and (min- 767px) {
    .mainmenu .collapse ul li:hover> ul{display:block}
    .mainmenu .collapse ul ul{position:absolute;top:100%;left:0;min-250px;display:none}
    /*******/
    .mainmenu .collapse ul ul li{position:relative}
    .mainmenu .collapse ul ul li:hover> ul{display:block}
    .mainmenu .collapse ul ul ul{position:absolute;top:0;left:100%;min-250px;display:none}
    /*******/
    .mainmenu .collapse ul ul ul li{position:relative}
    .mainmenu .collapse ul ul ul li:hover ul{display:block}
    .mainmenu .collapse ul ul ul ul{position:absolute;top:0;left:-100%;min-250px;display:none;z-index:1}
    
    }
    @media only screen and (max- 767px) {
    .navbar-nav .show .dropdown-menu .dropdown-menu > li > a{padding:16px 15px 16px 35px}
    .navbar-nav .show .dropdown-menu .dropdown-menu .dropdown-menu > li > a{padding:16px 15px 16px 45px}
    }    </style>
        <script src="js/jquery.min3.2.1.js"></script>
        <script src="js/bootstrap.min4.1.1.js"></script>
        <script type="text/javascript">
            window.alert = function(){};
            var defaultCSS = document.getElementById('bootstrap-css');
            function changeCSS(css){
                if(css) $('head > link').filter(':first').replaceWith('<link rel="stylesheet" href="'+ css +'" type="text/css" />'); 
                else $('head > link').filter(':first').replaceWith(defaultCSS); 
            }
            $( document ).ready(function() {
              var iframe_height = parseInt($('html').height()); 
              window.parent.postMessage( iframe_height, 'https://dusystem.com');
            });
        </script>
    </head>
    <body>
        <div class="text-center"><h2>Bootstrap 4 Multilevel Dropdown Menu</h2></div>
    
    <div id="menu_area" class="menu-area">
        <div class="container">
            <div class="row">
                <nav class="navbar navbar-light navbar-expand-lg mainmenu">
                    <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
                    <span class="navbar-toggler-icon"></span>
                    </button>
                    <div class="collapse navbar-collapse" id="navbarSupportedContent">
                        <ul class="navbar-nav mr-auto">
                            <li class="active"><a href="#">Home <span class="sr-only">(current)</span></a></li>
                            <li><a href="#">Link</a></li>
                            <li class="dropdown">
                                <a class="dropdown-toggle" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Dropdown</a>
                                <ul class="dropdown-menu" aria-labelledby="navbarDropdown">
                                <li><a href="#">Action</a></li>
                                <li><a href="#">Another action</a></li>
                                <li><a href="#">Something else here</a></li>
                                <li class="dropdown">
                                    <a class="dropdown-toggle" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Dropdown2</a>
                                    <ul class="dropdown-menu" aria-labelledby="navbarDropdown">
                                    <li><a href="#">Action</a></li>
                                    <li><a href="#">Another action</a></li>
                                    <li><a href="#">Something else here</a></li>
                                    <li class="dropdown">
                                        <a class="dropdown-toggle" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Dropdown3</a>
                                        <ul class="dropdown-menu" aria-labelledby="navbarDropdown">
                                            <li><a href="#">Action</a></li>
                                            <li><a href="#">Another action</a></li>
                                            <li><a href="#">Something else here</a></li>
                                        </ul>
                                    </li>
                                    </ul>
                                </li>
                                </ul>
                            </li>
                            <li><a href="#">Service</a></li>
                        </ul>
                    </div>
                </nav>
            </div>
        </div>
    </div>
    
    
    <br>
       <div class="text-center"><span><a href="https://dusystem.com">Bootstrap 3 Multilevel Dropdown Menu >></a></span></div>	<script type="text/javascript">
    	(function($){
    	$('.dropdown-menu a.dropdown-toggle').on('click', function(e) {
    	  if (!$(this).next().hasClass('show')) {
    		$(this).parents('.dropdown-menu').first().find('.show').removeClass("show");
    	  }
    	  var $subMenu = $(this).next(".dropdown-menu");
    	  $subMenu.toggleClass('show');
    
    	  $(this).parents('li.nav-item.dropdown.show').on('hidden.bs.dropdown', function(e) {
    		$('.dropdown-submenu .show').removeClass("show");
    	  });
    
    	  return false;
    	});
    })(jQuery)	</script>
    </body>
    </html>
    

      

  • 相关阅读:
    程序集冲突问题
    Linux 菜鸟学习笔记--系统分区
    gawk
    Ansible
    Linux 网关及路由
    Linux档案与目录管理
    find命令
    sed详解
    FTP服务
    Gentoo安装(虚拟机)
  • 原文地址:https://www.cnblogs.com/geovindu/p/13661871.html
Copyright © 2011-2022 走看看