Bootstrap选项卡不能切换

编程入门 行业动态 更新时间:2024-10-27 21:13:27
本文介绍了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使用了 .on(),它只在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: Demo - 由于错误而无法使用

With jQuery 1.6.4: Demo - not working because of error

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

演示: jQuery 1.7 , jQuery 1.9

更多推荐

Bootstrap选项卡不能切换

本文发布于:2023-11-27 20:48:34,感谢您对本站的认可!
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:选项卡   Bootstrap

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!