我有三个按钮和三个panels.i点击按钮panel1只在当时加载,panel2和3是不可见的。如果我点击button2 panel2加载,panel1和3是不可见的。我想改变我的按钮样式,如tabcontainer tabs.these三个按钮喜欢显示tabs.is它可能在CSS与CSS.net?
答案 0 :(得分:1)
您可以使用Togglable tabs
的概念<link href="assets/css/bootstrap.css" rel="stylesheet">
<link href="assets/css/bootstrap-responsive.css" rel="stylesheet">
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script src="assets/js/bootstrap-transition.js"></script>
<script src="assets/js/bootstrap-tab.js"></script>
<script>
$('#panel a').click(function(e) {
e.preventDefault();
$(this).tab('show');
})
// first active
$('#panel a:first').tab('show');
</script>
<div class="tabbable">
<ul id="panel" class="nav nav-tabs">
<li><a href="#button1" data-toggle="tab">Button 1</a></li>
<li><a href="#button2" data-toggle="tab">Button 2</a></li>
<li><a href="#button3" data-toggle="tab">Button 3</a></li>
</ul>
<div class="tab-content">
<div class="tab-pane fade in active" id="button1">
You have click button 1 and show a panel 1 </div>
<div class="tab-pane fade in " id="button2">You have click button 2 and show a panel 2</div>
<div class="tab-pane fade in " id="button3">You have click button 3 and show a panel 3 </div>
</div>
以下是演示: jsfiddle