标签:一个 世界 bootstra pop 初始化 mod post viewport item
data-toggle="collapse"——指明该元素具有折叠功能;
data-target——设置元素打开折叠后指向的元素链接。
.collapse——用来设置元素为折叠内容。
.in——设置折叠内容初始化为显示状态;
.panel-collapse——指明该元素内容为折叠面板样式。
很多其它细节请參考演示样例:
<!DOCTYPE html> <html lang="zh_CN"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width,initial-scale=1"> <title>饭盒儿——发现身边不一样的世界</title> <link rel="stylesheet" href="css/bootstrap.min.css" type="text/css"> <script src="js/jquery-2.1.3.min.js"></script> <script src="js/bootstrap.min.js"></script> <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries --> <!-- WARNING: Respond.js doesn't work if you view the page via file:// --> <!--[if lt IE 9]> <script src="//cdn.bootcss.com/html5shiv/3.7.2/html5shiv.min.js"></script> <script src="//cdn.bootcss.com/respond.js/1.4.2/respond.min.js"></script> <![endif]--> <style> </style> </head> <body> <div class="container"> <a class="btn btn-primary" data-toggle="collapse" href="#collapseExample">点击查看</a> <div class="collapse" id="collapseExample"> <div class="well"> Hello world </div> </div> <hr/> <div class="panel-group" id="accordion" role="tablist"> <div class="panel panel-default"> <div class="panel-heading" role="tab" id="headingOne"> <h4 class="panel-title"> <a data-toggle="collapse" data-parent="#accordion" href="#collapseOne">item1</a> </h4> </div> <div id="collapseOne" class="panel-collapse collapse in" role="tabpanel"> <div class="panel-body"> 这真是一个奇妙的站点 </div> </div> </div> <div class="panel panel-default"> <div class="panel-heading" role="tab" id="headingTwo"> <h4 class="panel-title"> <a data-toggle="collapse" data-parent="#accordion" href="#collapseTwo">item2</a> </h4> </div> <div id="collapseTwo" class="panel-collapse collapse" role="tabpanel"> <div class="panel-body"> 这真是一个奇妙的站点2 </div> </div> </div> <div class="panel panel-default"> <div class="panel-heading" role="tab" id="headingThree"> <h4 class="panel-title"> <a data-toggle="collapse" data-parent="#accordion" href="#collapseThree">item3</a> </h4> </div> <div id="collapseThree" class="panel-collapse collapse" role="tabpanel"> <div class="panel-body"> 这真是一个奇妙的站点3 </div> </div> </div> </div> </div> <script> // $("#accordion").on('hidden.bs.collapse',function(){ // alert("隐藏了"); // }) </script> </body> </html>
标签:一个 世界 bootstra pop 初始化 mod post viewport item
原文地址:http://www.cnblogs.com/slgkaifa/p/7299516.html