当我在jquery相关的切换中设置持续时间时,Bootstrap 3工具提示停止工作

时间:2013-11-19 10:59:46

标签: jquery html twitter-bootstrap twitter-bootstrap-3

我已经搜索了一段时间,但我还没有找到答案,我不确定问题到底在哪里(不确定即使它是一个自举错误),无论如何我做了一个水平导航栏固定在网站的顶部,隐藏了一些我希望切换的元素。

这些菜单条目是一个列表(如文档中的bootstrap所示),并且有一个类.hideMe,它被设置为隐藏的document.ready函数以及每个元素的相关引导程序工具栏:

jQuery( document ).ready(function (){
    $(".hideMe").hide();
    $('.tip').tooltip();  /*.tip is the class of the 'a' anchors that i need as tooltips*/
});

如果我调用与切换相关联的功能onclick一切正常:

function hideMe(){ 
    $(".hideMe").toggle();
}

但是,如果我将持续时间设置为slow,切换器会慢慢变为动画,但我不再看到工具提示,因为相关功能未加载:

function hideMe(){ 
    $(".hideMe").toggle('slow'); /*the animation is slow but no tooltip is shown*/
}

显然,即使速度为200500fast,也会出现同样的情况。我对这个问题没有任何线索,我已经尝试了一些我想到的,关于如何解决这个问题的想法?提前谢谢。

1 个答案:

答案 0 :(得分:0)

一切正常:

在此处查看演示 JSFIDDLE DEMO

HTML:

<div class="hideMe">Click me</div>
<div id="tog"></div>
<div id="tip" data-toggle="tooltip" title="Your Message on tooltip">Hove me</div>

JS:

$(function (){

    $(".hideMe").click(function(){
        $("#tog").toggle('slow');
    });
});

外部参考:

  1. JQUERY 1.9.1
  2. Bootstrap.min.css
  3. Bootstrap tooltip.js [ link ]