我是bootstrap的新手。我试图使用代码来制作带有可切换标签的页面。但是,我已多次检查我的代码,但我仍然无法在代码中找到问题。请问有人帮帮我吗?
<div class="row">
<div class="tabbable">
<ul class="nav nav-tabs" id="tabs" data-tabs="tabs">
<li class="active"><a href="#having_a" data-toggle="tab">Having a</a></li>
<li><a href="#having_b" data-toggle="tab">Having b</a></li>
<li><a href="#having_c" data-toggle="tab">Having c</a></li>
</ul>
<!-- content of the tab -->
<div class="tab-content" id="tab-content">
<div class="tab-pane active" id="having_a">
<p>a</p>
</div>
<div class="tab-pane" id="having_b">
<p>b</p>
</div>
<div class="tab-pane" id="having_c">
<p>c</p>
</div>
</div>
</div>
<script type="text/javascript">
jQuery(document).ready(function ($) {$('#tabs').tab(); });
</script>
</div>
<hr>
<footer>
<p>©2012</p>
</footer>
</div> <!-- /container -->
<!-- Le javascript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<script src="js/jquery.js"></script>
<script src="js/bootstrap-transition.js"></script>
<script src="js/bootstrap-alert.js"></script>
<script src="js/bootstrap-modal.js"></script>
<script src="js/bootstrap-dropdown.js"></script>
<script src="js/bootstrap-scrollspy.js"></script>
<script src="js/bootstrap-tab.js"></script>
<script src="js/bootstrap-tooltip.js"></script>
<script src="js/bootstrap-popover.js"></script>
<script src="js/bootstrap-button.js"></script>
<script src="js/bootstrap-collapse.js"></script>
<script src="js/bootstrap-carousel.js"></script>
答案 0 :(得分:1)
您没有在
中添加功能例如
<ul class="nav nav-tabs id="myTab">
<li class="active"><a href="#having_a" data-toggle="tab">Having a</a></li>
<li><a href="#having_b" data-toggle="tab">Having b</a></li>
<li><a href="#having_c" data-toggle="tab">Having c</a></li>
</ul>
<script>
$(function () {
$('#myTab').tab('show');
})
</script>