Twitter bootstrap v2和Jquery没有冲突 [英] Twitter bootstrap v2 and Jquery no conflict

查看:62
本文介绍了Twitter bootstrap v2和Jquery没有冲突的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用旧版本的Jquery(1.4.4)的网站上工作,因此无法更新此版本. 我想添加Twitter Bootstrap插件. 我如何使用jquery与这些插件没有冲突,因为它们会干扰使用Jquery 1.4的网站的其他功能? 引导插件的模式如下:

i m working on a website which uses an old version of Jquery (1.4.4), i can t update this version. I want to add Twitter Bootstrap plugins. How can i use jquery no conflict with these plugins because they are interfering with others functions of the website using Jquery 1.4? The pattern of bootstrap plugins is like this :

!function($) {
  // code here

  // plugin definition here

} ( window.jQuery);

也许是这样吗? :

<script type="text/javascript" src="/js/jquery.min17.js"></script>

     <script>
     var jq17 = jQuery.noConflict();
     </script> 

     <script type="text/javascript" src="/js/bootstrap-tab.js "></script> 

推荐答案

这很简单

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script>
<script>
    var $ = jQuery.noConflict();
</script>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script>
    var jq17 = jQuery.noConflict();
</script>

实时示例: http://jsbin.com/elomit/edit#javascript,html,live

这篇关于Twitter bootstrap v2和Jquery没有冲突的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆