bootstrap之Tab選項卡
阿新 • • 發佈:2019-02-12
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Tab選項卡</title>
<!--引用相應的CSS和JQ外掛-->
<link href="dist/css/bootstrap.css" rel="stylesheet" type="text/css">
<link href="dist/css/bootstrap.min.css" rel="stylesheet" type="text/css" >
<link href="dist/css/bootstrap-theme.css" rel="stylesheet" type="text/css">
<link href="dist/css/bootstrap-theme.min.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="js/tests/vendor/jquery.min.js"></script>
<script type="text/javascript" src="dist/bootstrap.js"></script>
<script type="text/javascript" src="dist/bootstrap.min.js"></script>
<script type="text/javascript" src="dist/npm.js"></script>
<script type="text/javascript" src="js/tab.js"></script>
</head>
<body>
<ul class="nav nav-tabs" id="myTab">
<li><a href="#home" data-toggle="tab">首頁</a></li>
<li><a href="#about" data-toggle="tab">關於</a></li>
<li><a href="#contact" data-toggle="tab">聯絡</a></li>
</ul>
<div class="tab-content">
<!--預設選擇home active-->
<div class="tab-pane active" id="home">
home
</div>
<div id="about" class="tab-pane">
about
</div>
<div id="contact" class="tab-pane">
contact
</div>
</div>
</body>
</html>
<script type="text/javascript">
/*啟用選項卡*/
$("#myTab a").click(function(e){
e.preventDefault();/*不要執行與事件有關的預設動作*/
$(this).tab('show');
})
</script>