zoukankan      html  css  js  c++  java
  • BootStrap最常用的几个插件(V3.3.0版)

    1、标签页

    <!-- Nav tabs -->
    <ul class="nav nav-tabs" role="tablist">
      <li role="presentation" class="active"><a href="#home" role="tab" data-toggle="tab">Home</a></li>
      <li role="presentation"><a href="#profile" role="tab" data-toggle="tab">Profile</a></li>
      <li role="presentation"><a href="#messages" role="tab" data-toggle="tab">Messages</a></li>
      <li role="presentation"><a href="#settings" role="tab" data-toggle="tab">Settings</a></li>
    </ul>
    
    <!-- Tab panes -->
    <div class="tab-content">
      <div role="tabpanel" class="tab-pane active" id="home">...</div>
      <div role="tabpanel" class="tab-pane" id="profile">...</div>
      <div role="tabpanel" class="tab-pane" id="messages">...</div>
      <div role="tabpanel" class="tab-pane" id="settings">...</div>
    </div>
    View Code
    使用js调用,切换标签页tab:
    
    Enable tabbable tabs via JavaScript (each tab needs to be activated individually):
    
    Copy
    $('#myTab a').click(function (e) {
      e.preventDefault()
      $(this).tab('show')
    })
    You can activate individual tabs in several ways:
    
    Copy
    $('#myTab a[href="#profile"]').tab('show') // Select tab by name
    $('#myTab a:first').tab('show') // Select first tab
    $('#myTab a:last').tab('show') // Select last tab
    $('#myTab li:eq(2) a').tab('show') // Select third tab (0-indexed)

    2、导航条

    <nav class="navbar navbar-default navbar-fixed-top" role="navigation">
      <div class="container-fluid">
        <!-- Brand and toggle get grouped for better mobile display -->
        <div class="navbar-header">
          <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
            <span class="sr-only">Toggle navigation</span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
          </button>
          <a class="navbar-brand" href="#">Brand</a>
        </div>
    
        <!-- Collect the nav links, forms, and other content for toggling -->
        <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
          <ul class="nav navbar-nav">
            <li class="active"><a href="#">Link</a></li>
            <li><a href="#">Link</a></li>
            <li class="dropdown">
              <a href="#" class="dropdown-toggle" data-toggle="dropdown">Dropdown <span class="caret"></span></a>
              <ul class="dropdown-menu" role="menu">
                <li><a href="#">Action</a></li>
                <li><a href="#">Another action</a></li>
                <li><a href="#">Something else here</a></li>
                <li class="divider"></li>
                <li><a href="#">Separated link</a></li>
                <li class="divider"></li>
                <li><a href="#">One more separated link</a></li>
              </ul>
            </li>
          </ul>
          <form class="navbar-form navbar-left" role="search">
            <div class="form-group">
              <input type="text" class="form-control" placeholder="Search">
            </div>
            <button type="submit" class="btn btn-default">Submit</button>
          </form>
          <ul class="nav navbar-nav navbar-right">
            <li><a href="#">Link</a></li>
            <li class="dropdown">
              <a href="#" class="dropdown-toggle" data-toggle="dropdown">Dropdown <span class="caret"></span></a>
              <ul class="dropdown-menu" role="menu">
                <li><a href="#">Action</a></li>
                <li><a href="#">Another action</a></li>
                <li><a href="#">Something else here</a></li>
                <li class="divider"></li>
                <li><a href="#">Separated link</a></li>
              </ul>
            </li>
          </ul>
        </div><!-- /.navbar-collapse -->
      </div><!-- /.container-fluid -->
    </nav>

    3、图片轮播

        <div id="carousel-example-generic" class="carousel slide" data-ride="carousel">
            <!-- 这是小圆圈 -->
            <ol class="carousel-indicators">
                <li data-target="#carousel-example-generic" data-slide-to="0" class="active"></li>
                <li data-target="#carousel-example-generic" data-slide-to="1"></li>
                <li data-target="#carousel-example-generic" data-slide-to="2"></li>
            </ol>
            <!-- 这是图片 -->
            <div class="carousel-inner" role="listbox">
                <div class="item active">
                    <img src="..." alt="...">
                    <div class="carousel-caption">
                        ...<!--图片描述信息-->
                    </div>
                </div>
                <div class="item">
                    <img src="..." alt="...">
                    <div class="carousel-caption">
                        ...
                    </div>
                </div>
                ...
            </div>
            <!-- Controls -->
            <a class="left carousel-control" href="#carousel-example-generic" role="button" data-slide="prev">
                <span class="glyphicon glyphicon-chevron-left"></span><span class="sr-only">Previous</span>
            </a><a class="right carousel-control" href="#carousel-example-generic" role="button"
                data-slide="next"><span class="glyphicon glyphicon-chevron-right"></span><span class="sr-only">
                    Next</span> </a>
        </div>


    //左右触摸滑动

    $(".carousel-inner .item").on("swipeLeft", function () {
      $(".carousel").carousel('prev');
    });
    $(".carousel-inner .item").on("swipeRight", function () {
      $(".carousel").carousel('next');
    });

     
  • 相关阅读:
    纯css切换左侧菜单
    HDU——T 1556 Color the ball
    CODEVS——T 1404 字符串匹配
    HDU——T 1506 Largest Rectangle in a Histogram|| POJ——T 2559 Largest Rectangle in a Histogram
    BZOJ——T 1113: [Poi2008]海报PLA
    POJ——T 2796 Feel Good
    November 27th 2016 Week 48th Sunday
    November 26th 2016 Week 48th Saturday
    November 25th 2016 Week 48th Friday
    November 24th 2016 Week 48th Thursday
  • 原文地址:https://www.cnblogs.com/lxf1117/p/4158442.html
Copyright © 2011-2022 走看看