官网的例子:

http://v3.bootcss.com/javascript/#collapse

<div class="panel-group" id="accordion" role="tablist" aria-multiselectable="true">
<div class="panel panel-default">
<div class="panel-heading" role="tab" id="headingOne">
<h4 class="panel-title">
<a role="button" data-toggle="collapse" data-parent="#accordion" href="#collapseOne" aria-expanded="true" aria-controls="collapseOne">
Collapsible Group Item #1
</a>
</h4>
</div>
<div id="collapseOne" class="panel-collapse collapse in" role="tabpanel" aria-labelledby="headingOne">
<div class="panel-body">
Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor, sunt aliqua put a bird on it squid single-origin coffee nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident. Ad vegan excepteur butcher vice lomo. Leggings occaecat craft beer farm-to-table, raw denim aesthetic synth nesciunt you probably haven't heard of them accusamus labore sustainable VHS.
</div>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading" role="tab" id="headingTwo">
<h4 class="panel-title">
<a class="collapsed" role="button" data-toggle="collapse" data-parent="#accordion" href="#collapseTwo" aria-expanded="false" aria-controls="collapseTwo">
Collapsible Group Item #2
</a>
</h4>
</div>
<div id="collapseTwo" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingTwo">
<div class="panel-body">
Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor, sunt aliqua put a bird on it squid single-origin coffee nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident. Ad vegan excepteur butcher vice lomo. Leggings occaecat craft beer farm-to-table, raw denim aesthetic synth nesciunt you probably haven't heard of them accusamus labore sustainable VHS.
</div>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading" role="tab" id="headingThree">
<h4 class="panel-title">
<a class="collapsed" role="button" data-toggle="collapse" data-parent="#accordion" href="#collapseThree" aria-expanded="false" aria-controls="collapseThree">
Collapsible Group Item #3
</a>
</h4>
</div>
<div id="collapseThree" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingThree">
<div class="panel-body">
Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor, sunt aliqua put a bird on it squid single-origin coffee nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident. Ad vegan excepteur butcher vice lomo. Leggings occaecat craft beer farm-to-table, raw denim aesthetic synth nesciunt you probably haven't heard of them accusamus labore sustainable VHS.
</div>
</div>
</div>
</div>

官网的效果:

自己根据这个折叠组件写的:--看折叠组件部分的代码就好了。

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>导航测试</title>
<link rel="stylesheet" type="text/css" href="bootstrap/bootstrap.min.css">
<style type="text/css">
.navbar-inverse .navbar-header .active{
background-color: #31708f;
}
.navbar-inverse .navbar-brand {
color: #fff;
cursor: pointer;
padding: 15px 25px;
font-size: 14px;
}
.navbar-inverse {
background-color: #337ab7;
border-color: #337ab7;
}
.navbar-inverse .navbar-nav>li>a {
color: #fff;
} .navbar-inverse .navbar-nav>.active>a, .navbar-inverse .navbar-nav>.active>a:focus, .navbar-inverse .navbar-nav>.active>a:hover{
color: #fff;
background-color: #31708f;
}
.navbar-inverse .navbar-nav>.open>a, .navbar-inverse .navbar-nav>.open>a:focus, .navbar-inverse .navbar-nav>.open>a:hover{
color: #fff;
background-color: #337ab7;
}
input#sw{
font-style: italic;
color: #aaa;
}
.navbar-inverse .navbar-collapse, .navbar-inverse .navbar-form{
border-color: #337ab7;
}
@media (max-width: 767px){
.navbar-inverse .navbar-nav .open .dropdown-menu .divider{
background-color: rgba(0,0,0,.075);
}
} /* 产品分类 */
ul.product_category li {
float: left;
list-style: none;
}
ul.product_category {
padding: 0;
}
.product_category >li{
padding: 5px 25px;
}
.product_category >li.active{
background: #ccc;
} /* 手机版产品分类导航 */
ul.product_category_mobile>li {
padding: 5px 0;
width: 33.3%;
text-align: center;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.product_category_mobile{
padding: 0;
}
#accordion .category_arrow{
float: right;
padding: 0 10px;
}
.panel-heading>li{
float: left;
list-style: none;
}
@media (max-width: 767px){
.pc{
display: none;
}
.mobile{
display: block;
}
} @media(min-width: 768px){
.pc{
display: block;
}
.mobile{
display: none;
}
}
</style>
</head>
<body>
<div class="container">
<div class="row">
<nav class="navbar navbar-inverse">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
<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 active" onclick="alert('all')">全部</a>
</div> <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">按场景选择 <span class="caret"></span></a>
<ul class="dropdown-menu">
<li><a href="#">全部</a></li>
<li role="separator" class="divider"></li>
<li><a href="#">规划</a></li>
<li><a href="#">实施</a></li>
<li><a href="#">维护</a></li>
</ul>
</li>
<li class="active"><a href="#">我的收藏</a></li>
<li><a href="#">最近浏览</a></li>
</ul>
<form class="navbar-form navbar-right">
<div class="input-group">
<input id="sw" type="text" class="form-control" value="请输入关键字(名称/描述)">
<span class="input-group-btn">
<button class="btn btn-default" type="button">搜索</button>
</span>
</div>
<!--
<div class="form-group">
<input id="sw" type="text" class="form-control" value="请输入关键字(名称/描述)">
</div>
<input type="button" class="btn btn-default" value="搜索"/>
-->
</form>
</div>
</nav>
</div> <!-- 产品分类 -->
<div class="row pc">
<ul class="product_category clearfix">
<li><a href="#">所有产品</a></li>
<li class="active"><a href="#">交换机</a></li>
<li><a href="#">路由器</a></li>
<li><a href="#">传送网</a></li>
<li><a href="#">WLAN</a></li>
<li><a href="#">SDN控制器</a></li>
<li><a href="#">无线局域网</a></li>
</ul>
</div> <!-- 手机端产品分类展示 -->
<div class="row mobile">
<div class="panel-group" id="accordion" role="tablist" aria-multiselectable="true">
<div class="panel">
<div class="panel-heading clearfix" role="tab">
<li><a href="#">所有产品</a></li>
<a class="category_arrow" role="button" data-toggle="collapse" data-parent="#accordion" href="#collapseOne" aria-expanded="true">
<span class="glyphicon glyphicon-menu-down"></span>
</a>
</div>
<div id="collapseOne" class="panel-collapse collapse" role="tabpanel">
<div class="panel-body">
<ul class="product_category product_category_mobile clearfix">
<li class="active"><a href="#">交换机</a></li>
<li><a href="#">路由器</a></li>
<li><a href="#">传送网</a></li>
<li><a href="#">WLAN</a></li>
<li><a href="#">SDN控制器</a></li>
<li><a href="#">无线局域网无线局域网无线局域网</a></li>
</ul>
</div>
</div>
</div>
</div>
</div>
</div> </body>
<script src="jquery/jquery.min.js"></script>
<script src="bootstrap/bootstrap.min.js"></script>
<script type="text/javascript"> </script>
</html>

bootstrap的折叠组件1的更多相关文章

  1. bootstrap导航条组件

    一.导航条模板(官方文档) <nav class="navbar navbar-default"> <div class="container-flui ...

  2. 利用bootstrap的modal组件自定义alert,confirm和modal对话框

    由于浏览器提供的alert和confirm框体验不好,而且浏览器没有提供一个标准的以对话框的形式显示自定义HTML的弹框函数,所以很多项目都会自定义对话框组件.本篇文章介绍自己在项目中基于bootst ...

  3. bootstrap轮播组件,大屏幕图片居中效果

    在慕课网学习bootstrap轮播组件的时候,了解到轮播的图片都放在了类名为item下的img中 视频中老师对图片自适应采用给图片img设置width=100%完成,然而这样自适应处理图片在不同屏幕中 ...

  4. bootstrap 之 列表组件使用

    列表是几乎所有网站都会用到的一个组件,正好bootstrap也给我们提供了这个组件的样式,下面我给大家简单介绍一下bootstrap中的列表组件的用法! 首先,重提一下引用bootstrap的核心文件 ...

  5. bootstrap轮播组件之“如何关闭自动轮播”

    在一个页面里使用多个bootstrap轮播组件的时候,如果还让所有轮播图都自动轮播的话,整个画面都在动,会给用户一种很不好的体验感受.所以,需要关闭轮播图的自动轮播. 关闭方法:去除如下属性即可: d ...

  6. bootstrap课程5 bootstrap中的组件使用的注意事项是什么

    bootstrap课程5 bootstrap中的组件使用的注意事项是什么 一.总结 一句话总结: 1.img-responsive的作用是什么(其实还是要多看手册)? 看起来像width=100%的效 ...

  7. Bootstrap Blazor Table 组件(二)

    原文链接:https://www.cnblogs.com/ysmc/p/16128206.html 很多小伙伴在使用 Bootstrap Blazor Table组件的时候,都会有这样的一个需求: 我 ...

  8. 【BootStrap】 布局组件 I

    BootStrap布局组件 I 除了在原生的HTML基础上进行了外观和类别上的改进,BS还包装了很多组件进库中,设计网页时我们可以方便地调用这些组件.下面来简略地介绍一下各种各样的组件 ■ 字体图标 ...

  9. bootStrap树形目录组件

    需求描述 产品添加页面,需要选择车型.在bootStrap的modal上弹出子modal来使用.车型一共有4级目录.要使用目录树.然后分活动和商品两种,需要能够通过不通参数来调用该组件.车型品牌要使用 ...

随机推荐

  1. redis在.net架构中的应用(1)--利用servicestack连接redis

    引言:作为少有的.net架构下的大型网站,stackoverflow曾发表了一篇文章,介绍了其技术体系,原文链接http://highscalability.com/blog/2011/3/3/sta ...

  2. LeetCode OJ:Longest Increasing Subsequence(最长递增序列)

    Given an unsorted array of integers, find the length of longest increasing subsequence. For example, ...

  3. Python3安装(二)

    因为Python是跨平台的,它可以运行在Windows.Mac和各种Linux/Unix系统上.在Windows上写Python程序,放到Linux上也是能够运行的. 要开始学习Python编程,首先 ...

  4. ios 第2天

    类的方法和实例的方法 -(void)runwithspeed:(int)speed and direction:(int)direction; 实例方法 -开头 运用对象调用 函数名为runwiths ...

  5. New Concept English there (6)

    30w/m The expensive shops in a famous arcade near Piccadilly were just opening. At this time of the  ...

  6. a的样式

    .myAucCItem a { color: rgb(71,71,71);} .myAucCItem a:hover { color: rgb(71,71,71); text-decoration: ...

  7. C++实现线程同步的几种方式

    线程同步是指同一进程中的多个线程互相协调工作从而达到一致性.之所以需要线程同步,是因为多个线程同时对一个数据对象进行修改操作时,可能会对数据造成破坏,下面是多个线程同时修改同一数据造成破坏的例子: # ...

  8. currentTarget,this,target区别

    currentTarget  : 事件处理程序当前正在处理事件的那个元素 this : 当前的事件发生的元素 target : 事件的目标 currentTarget和this值是始终相等的,但是ta ...

  9. 《Unity 3D游戏客户端基础框架》消息系统

    功能分析: 首先,我们必须先明确一个消息系统的核心功能: 一个通用的事件监听器 管理各个业务监听的事件类型(注册和解绑事件监听器) 全局广播事件 广播事件所传参数数量和数据类型都是可变的(数量可以是 ...

  10. 通过摄像机视频设备或者流媒体服务器SDK获取到数据转换成RTMP流实现网页/手机微信播放

    写这篇博客主要是为了给新入门的流媒体开发者解惑,现在看到各种开发者的需求:网页播放RTSP摄像机.微信播放RTSP摄像机.网页播放摄像机SDK输出的视频流.网页播放第三方流媒体平台输出的视频流.包括G ...