简体   繁体   English

Twitter Bootstrap 工具提示()停止工作

[英]Twitter Bootstrap tooltip() stopped working

Having a problem with Bootstrap tooltips suddenly not working. Bootstrap 工具提示出现问题突然不起作用。 They are being included like this:它们被包括在内:

//Gemfile
gem 'bootstrap-sass', '~> 3.2'

//application.js
//= require jquery
//= require bootstrap

//application.sass
@import "bootstrap"

They have been included like this for the past year with no problem.在过去的一年里,它们被这样包括在内,没有任何问题。 In dev tools I can even get a reference to jQuery element and the auto complete of dev tools shows that tooltip() is available.在开发工具中,我什至可以获得对 jQuery 元素的引用,开发工具的auto complete显示tooltip()可用。

But when I call tooltip() on the element, upon hovering over this element—nothing happens.但是当我在元素上调用tooltip()时,当tooltip()悬停在这个元素上时——什么也没有发生。

I do this same action on http://getbootstrap.com/ it works.我在http://getbootstrap.com/上做了同样的操作,它有效。

开发工具在此处输入图片说明

Another strange thing is when I use the html attributes to trigger a tooltip, like so:另一个奇怪的事情是当我使用 html 属性触发工具提示时,如下所示:

//using Slim as an example
a[href title="hello world" data-toggle="tooltip" data-placement="left"] My Link

I do get a tooltip but the style is all wrong我确实得到了一个工具提示,但风格全错了在此处输入图片说明

I inspected the tooltip and copied this tooltips HTML:我检查了工具提示并复制了这个工具提示 HTML:

<div role="tooltip" class="ui-tooltip ui-widget ui-corner-all ui-widget-content" id="ui-id-15" style="position: relative; top: -483.25px; left: 0px; display: block;">          
<div class="ui-tooltip-content">hello world</div>

I did the same for the tooltip on http://getbootstrap.com/ :我对http://getbootstrap.com/上的工具提示做了同样的事情:

<div class="tooltip fade bottom in" role="tooltip" id="tooltip136998" style="top: 18263px; left: 492.984px; display: block;">

Tooltip on bottom底部的工具提示

The HTML is even different. HTML 甚至不同。 My tooltip has no arrow.我的工具提示没有箭头。

I am using Rails, sass, Angular, bootstrap via the 'bootstrap-sass' gem我正在通过“bootstrap-sass” gem 使用 Rails、sass、Angular 和 bootstrap

It looks that you have j Query UI tooltip in your project that conflicts with the Bootstrap's.看起来您的项目中有与 Bootstrap 冲突的 j Query UI 工具提示

Either get rid of jQuery UI or use the following workarounds (depending on your libraries load order):摆脱 jQuery UI 或使用以下解决方法(取决于您的库加载顺序):

// bootstrap -> workaround -> jQueryUI
$.fn.bootstrapTooltip = $.fn.tooltip.noConflict();

// jQueryUI -> workaround -> bootstrap
$.widget.bridge('uitooltip', $.ui.tooltip);

UPD: note that if you decide to use both libraries in your project, you might also need a workaround for jQueryUI/Bootstrap $.fn.button . UPD:请注意,如果您决定在项目中同时使用这两个库,您可能还需要针对 jQueryUI/Bootstrap $.fn.button的解决方法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM