本文介绍了Bootstrap选项卡不能切换的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时删除!!

<html>
<head>
<script src="js/jquery.1.6.1.min.js"></script>
<link rel="stylesheet" href="css/bootstrap.min.css" />
<link rel="stylesheet" href="css/bootstrap.css" />
<link rel="stylesheet" href="stylesheets/bootstrap-responsive.css">

<script src="css/bootstrap.min.js"></script>
<script src="css/bootstrap.js"></script>
</head>
<body>
 <ul class="nav nav-tabs id="tabs">
<li><a href="#tab1" data-toggle="tab">Tab 1</a></li>
<li><a href="#tab2" data-toggle="tab">Tab 2</a></li>
<li><a href="#tab3" data-toggle="tab">Tab 3</a></li>
</ul>

<div class="tab-content">
<div id="tab1" class="tab-pane">
This is the text of tab1.
</div>

<div id="tab2" class="tab-pane">
<p>This is the text of tab2.</p>
</div>

<div id="tab3" class="tab-pane">
<p>This is the text of tab3.</p>
</div>
</div>
</html>

我试过了所有的东西,基本上它不会切换标签,我甚至尝试从其他网站复制源代码,但它仍然无法工作。

I've tried everything and basically it just won't switch tabs. I've even tried copying source code from other sites and it still won't work.

推荐答案

我认为问题出在jQuery版本1.6,bootstrap使用了,它只在jQuery的版本1.7中添加。所以升级jQuery到一个更新的版本,它应该很好

I think the problem is with the jQuery verison 1.6, bootstrap used .on() which was added only in jQuery verision 1.7. So upgrade jQuery to a newer version and it should be fine

使用jQuery 1.6.4: - 由于错误而无法使用

With jQuery 1.6.4: Demo - not working because of error

Uncaught TypeError: Object [object Object] has no method 'on'

演示:,

这篇关于Bootstrap选项卡不能切换的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

1403页,肝出来的..

09-06 20:13