Bootstrap和jQueryUI冲突 [英] Bootstrap and jQueryUI Conflict

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

问题描述

我试图在引用 jQueryUI Bootstrap 3 的视图中使用 tooltip 。我在此处提供了示例。如果我加载Boostrap后jQueryUI的js然后 tooltip()调用是成功的,但如果我调用jQueryui后Bootstrap然后我得到一个错误,没有什么工作。你可以自己试试。在互联网上有很多关于这一点的讨论,我问过GitHub,但我还是找不到解决方案。

I am trying to use tooltip on a View that has reference to both jQueryUI and Bootstrap 3. I have made a sample here. If I load the Boostrap after jQueryUI's js then the tooltip() call is successful but if I call jQueryUI after Bootstrap then I get an error and nothing works. You can try it out yourself. There is a lot of talk going on about this on the Internet and I asked around GitHub but I could not find a solution yet.

推荐答案

p>理想的解决方案将采取QueryUI没有工具提示。这将工作。如果你不想这样做,请在JQueryUI之后包括Bootstrap。确保您每个都有唯一的组件(您可以自定义生成带有必需组件的库)

Ideal solution will be to take QueryUI without tooltip. This will work. In case you don't want to do that please include Bootstrap after JQueryUI. Ensure you have unique components from each (you can custom build both libraries with required components)

Bootstrap可以重置任何组件,如:

Bootstrap has a way to to reset any component like:

var bootstrapButton = $.fn.button.noConflict() // return $.fn.button to previously assigned value
$.fn.bootstrapBtn = bootstrapButton            // give $().bootstrapBtn the Bootstrap functionality

上面的代码在bootstrap是在JQueryUI之后加载的

The above code will work when bootstrap is loaded after JQueryUI

参考文献: http://getbootstrap.com/javascript/

以下是Bootstrap的相关代码:

Here is relevant code from Bootstrap:

  var old = $.fn.tooltip

  $.fn.tooltip = function (option) {
    ....
  }


  $.fn.tooltip.noConflict = function () {
    $.fn.tooltip = old
    return this
  }

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

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