• 使用Bootstrap创建响应式hamburger菜单


    In order to add responsive features to the navigation bar, the content to be collapsed must be wrapped in <div> with class “.collapse” and “.navbar-collapse”. The collapsed navigation bar actually is a button with class “.navbar-toggle” and two data- elements. One is data-toggle, and another one is data-target.

    Then we can add three <span> with class “.icon-bar” to create the "hamburger ".

    <!DOCTYPE html>
    <html>
    <head>
        <meta charset="utf-8">
        <title>Bootstrap hamburger</title>
        <link rel="stylesheet" href="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/css/bootstrap.min.css">
        <script src="https://cdn.staticfile.org/jquery/2.1.1/jquery.min.js"></script>
        <script src="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/js/bootstrap.min.js"></script>
    </head>
    <body>
    
    <nav class="navbar navbar-default" role="navigation">
        <div class="container-fluid"> 
        <div class="navbar-header">
            <button type="button" class="navbar-toggle" data-toggle="collapse"
                    data-target="#example-navbar-collapse">
                <span class="sr-only">Switch Navigator</span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
            </button>
            <a class="navbar-brand" href="#">Language</a>
        </div>
        <div class="collapse navbar-collapse" id="example-navbar-collapse">
            <ul class="nav navbar-nav">
                <li class="dropdown">
                    <a href="#" class="dropdown-toggle" data-toggle="dropdown">
                        C# <b class="caret"></b>
                    </a>
                    <ul class="dropdown-menu">
                        <li><a href="#">Winforms</a></li>
                        <li><a href="#">ASP.NET</a></li>
                        <li><a href="#">Xamarin</a></li>
                    </ul>
                </li>
    
                <li class="dropdown">
                    <a href="#" class="dropdown-toggle" data-toggle="dropdown">
                        Python<b class="caret"></b>
                    </a>
                    <ul class="dropdown-menu">
                        <li><a href="#">Django</a></li>
                        <li><a href="#">Spyder</a></li>
                        <li><a href="#">Pygame</a></li>
                    </ul>
                </li>
                <li class="dropdown">
                    <a href="#" class="dropdown-toggle" data-toggle="dropdown">
                        Java <b class="caret"></b>
                    </a>
                    <ul class="dropdown-menu">
                        <li><a href="#">Android</a></li>
                        <li><a href="#">Java Web</a></li>
                        <li><a href="#">JDK</a></li>
                    </ul>
                </li>
            </ul>
        </div>
        </div>
    </nav>
    
    </body>
    </html>

    The demo gif,

  • 相关阅读:
    SQL Server 2005中的分区表(六):将已分区表转换成普通表
    关于SQL Server中分区表的文件与文件组的删除(转)
    MySQL修改root密码的几种方法
    Aptana 插件 for Eclipse 4.4
    IT励志与指导文章合集(链接)
    正则表达式(转)
    《疯狂原始人》温馨而搞笑片段截图
    指针函数与函数指针的区别(转)
    Linux内核@系统组成与内核配置编译
    2015年我国IT行业发展趋势分析(转)
  • 原文地址:https://www.cnblogs.com/jizhiqiliao/p/12988259.html
Copyright © 2020-2023  润新知