0

我有一个工作版本的工具提示(jQuery 工具 - http://flowplayer.org/tools/demos/tooltip/index.html),

jQuery(document).ready(function() { 
jQuery('.more_info').each(function(){
   jQuery(this).tooltip({ 
       effect: 'slide',
       offset: [10, 570],
       predelay: 100, 
       position: "bottom left"}).dynamic( { 
        bottom: { 
        direction: 'down', 
        bounce: true 
    } 
    }); 
});   

});

加载 ajax 后,工具提示不再工作,因为脚本已经加载,我尝试了论坛http://flowplayer.org/tools/forum/30/37281的解决方案,但没有工作,或者没有正确实施

这是代码:

jQuery(document).ready(function() { 
jQuery('.more_info').each(function(){
   jQuery(this).not('.tt_init').tooltip({ 
       effect: 'slide',
       offset: [10, 570],
       predelay: 100, 
       position: "bottom left"}).dynamic( { 
        bottom: { 
        direction: 'down', 
        bounce: true 
        } 
    });
    jQuery(this).not('.tt_init').addClass('tt_init'); 
});   

});

什么都没有......我做错了什么,谢谢你的帮助;),对不起我的英语不好

4

2 回答 2

2

如果问题是动态内容,您可以尝试使用livejQuery api。

jQuery('.more_info').live('mouseover', function(){
    // may need to check here if it already has a tooltip (depending on plugin)
    jQuery(this).tooltip({ 
       effect: 'slide',
       offset: [10, 570],
       predelay: 100, 
       position: "bottom left"}).dynamic( { 
           bottom: { 
           direction: 'down', 
           bounce: true 
       } 
  }); 
});

另一种解决方案是手动激活 ajax 内容的工具提示。就像是:

$('#result').load('ajax/test.html', function() {
  $(this).find('.more_info').tooltip({*/...*/});
});

或者您可以使用全局响应者对所有 ajax 请求执行此操作。

于 2011-01-13T16:11:04.290 回答
2

与以下相同的解决方案:

livequery 不适用于组

使用 livequery 插件。如果工具提示适用于所有页面,则应每次刷新。这是 livequery 进来的。

另请检查此链接:

ajax回调后JQuery slimbox重新绑定

于 2011-01-13T16:11:33.777 回答