• bootstrap-js(2)下拉菜单


    1.下面的实例演示了在导航栏内和标签内的下拉菜单的用法:

    <!DOCTYPE HTML>
    <html>
    <head>
    <link href="/stylesheets/bootstrap.min.css" rel="stylesheet" >
    <script src="/scripts/jquery.min.js"></script>
    <script src="/scripts/bootstrap.min.js"></script>
    </head>
    <body>
    <nav class="navbar navbar-default" role="navigation">
    <div>
    <ul class="nav navbar-nav">
    <li class="active"><a href="javascripts:void(0);">iOS</a></li>
    <li><a href="javascripts:void(0);">SVN</a></li>
    <li class="dropdown">
    <a href="javascripts:void(0);" class="dropdown-toggle" data-toggle="dropdown">
    Java
    <b class="caret"></b>
    </a>
    <ul class="dropdown-menu">
    <li><a href="javascripts:void(0);">jmeter</a></li>
    <li><a href="javascripts:void(0);">EJB</a></li>
    <li><a href="javascripts:void(0);">Jasper Report</a></li>
    <li class="divider"></li>
    <li><a href="javascripts:void(0);">分离的链接</a></li>
    <li class="divider"></li>
    <li><a href="javascripts:void(0);">另一个分离的链接</a></li>
    </ul>
    </li>
    </ul>
    </div>
    </nav>


    <p>带有下拉菜单的标签页</p>
    <ul class="nav nav-tabs">
    <li class="active"><a href="javascripts:void(0);">Home</a></li>
    <li><a href="javascripts:void(0);">SVN</a></li>
    <li><a href="javascripts:void(0);">iOS</a></li>
    <li><a href="javascripts:void(0);">VB.Net</a></li>
    <li class="dropdown">
    <a class="dropdown-toggle" data-toggle="dropdown" href="javascripts:void(0);">
    Java <span class="caret"></span>
    </a>
    <ul class="dropdown-menu">
    <li><a href="javascripts:void(0);">Swing</a></li>
    <li><a href="javascripts:void(0);">jMeter</a></li>
    <li><a href="javascripts:void(0);">EJB</a></li>
    <li class="divider"></li>
    <li><a href="javascripts:void(0);">分离的链接</a></li>
    </ul>
    </li>
    <li><a href="javascripts:void(0);">PHP</a></li>
    </ul>
    </body>
    </html>

    2.用法


    可以切换下拉菜单(Dropdown)插件的隐藏内容:

      通过 data 属性:向链接或按钮添加 data-toggle="dropdown" 来切换下拉菜单,如下所示:

    1. <div class="dropdown">
    2. <a data-toggle="dropdown" href="#">下拉菜单(Dropdown)触发器</a>
    3. <ul class="dropdown-menu" role="menu" aria-labelledby="dLabel">
    4. ...
    5. </ul>
    6. </div>

      如果您需要保持链接完整(在浏览器不启用 JavaScript 时有用),请使用 data-target 属性代替 href="#":

    1. <div class="dropdown">
    2. <a id="dLabel" role="button" data-toggle="dropdown" data-target="#" href="/page.html">
    3. 下拉菜单(Dropdown) <span class="caret"></span>
    4. </a>
    5.  
    6. <ul class="dropdown-menu" role="menu" aria-labelledby="dLabel">
    7. ...
    8. </ul>
    9. </div>

      通过 JavaScript:通过 JavaScript 调用下拉菜单切换,请使用下面的方法:

    1. $('.dropdown-toggle').dropdown()

    例子:

    <!DOCTYPE HTML>
    <html>
    <head>
    <link href="/stylesheets/bootstrap.min.css" rel="stylesheet" >
    <script src="/scripts/jquery.min.js"></script>
    <script src="/scripts/bootstrap.min.js"></script>
    </head>
    <body>
    <div class="dropdown">
    <a data-toggle="dropdown" href="#">下拉菜单(Dropdown)触发器(点击)</a>
    <ul class="dropdown-menu" role="menu" aria-labelledby="dLabel">
    <li class="active"><a href="javascripts:void(0);">iOS</a></li>
    <li><a href="javascripts:void(0);">SVN</a></li>
    </ul>
    </div>

    <div class="dropdown">
    <a id="dLabel" role="button" data-toggle="dropdown" data-target="#" href="/page.html">
    下拉菜单(Dropdown) <span class="caret"></span>
    </a>

    <ul class="dropdown-menu" role="menu" aria-labelledby="dLabel">
    <li class="active"><a href="javascripts:void(0);">iOS</a></li>
    <li class="active"><a href="javascripts:void(0);">iOS</a></li>
    </ul>
    </div>
    </body>
    </html>

    3.方法


    下拉菜单切换有一个简单的方法用来显示或隐藏下拉菜单。

    1. $().dropdown('toggle')
  • 相关阅读:
    arcgis server adf java
    JBoss4.2.3下载地址
    关心
    [转载]通过Arcgis Server向MXD中添加图层
    arcgis server问题总结
    想和做
    无敌
    [转载]通过Arcgis Server将某一图层从MXD中…
    Error retrieving "feature.xml".
    360很强大
  • 原文地址:https://www.cnblogs.com/qiuzhimutou/p/4755985.html
Copyright © 2020-2023  润新知