【发布时间】:2014-08-03 20:27:27
【问题描述】:
我必须解决 jQuery UI 和 Bootstrap 之间的冲突,因为我需要这两个工具提示功能。
这就是我所做的:
包括:
- jQuery-1.7.2.min.js
- 用户界面的东西
- 引导程序(v3.1.1 缩小版)
- 解决冲突 js
- 另一个调用引导工具提示的 JavaScript
这是我的修复:
$(document).ready(function() {
// Tooltip
var bootstrapTooltip = $.fn.tooltip.noConflict(); // return $.fn.button to previously assigned value
$.fn.bootstrapTooltip = bootstrapTooltip; // give $().bootstrapTooltip the Bootstrap functionality
});
这是我的电话:
$(document).ready(function() {
$('.icon-tooltip').bootstrapTooltip();
});
这是 HTML:
<a onclick="return false;" rel="nofollow" href="" class="icon-tooltip"
title="{% trans from "...." %}landingpage......
data-toggle="tooltip"
data-placement="bottom"
data-html="true">
<i class="icon icon-help-circled"></i>
</a>
会发生什么:
当用户将鼠标悬停在 a.icon-tooltip 上时会显示工具提示(格式正确),但在离开元素时,它会返回此错误:
TypeError: a(...)this.type.data 不是函数
这是Bootstrap中的位置:
var c=b instanceof this.constructor?b:a(b.currentTarget)[this.type](this.getDelegateOptions()).data("bs."+this.type);
【问题讨论】:
标签: jquery twitter-bootstrap user-interface tooltip