jQuery Tooltip插件错误 [英] jQuery Tooltip plugin error
问题描述
我编写了这段代码,将'jQuery Tooltip插件'应用于ajax加载的元素。
i have written this code to apply 'jQuery Tooltip plugin' to ajax loaded elements.
我的意思是我要在其鼠标悬停上显示工具提示的行被加载到页面由ajax。
这里是代码:
i mean the row i want to show tooltip on its mouseover is loaded into page by ajax. here's the code:
$("[id^=pane]").delegate("[id^=comm]","mouseover",function() {
$(this).tooltip({
// each trashcan image works as a trigger
tip: "#tooltip",
// custom positioning
position: "center right",
// move tooltip a little bit to the right
offset: [0, 15],
// there is no delay when the mouse is moved away from the trigger
delay: 0
}).dynamic({ bottom: { direction: "down", bounce: true } });
});
鼠标悬停时显示工具提示但firebug报告此错误:
the tooltip is shown when mouseover but firebug report this error:
$(this).tooltip({tip:#tooltip,position:center right,offset:[0,15],delay:0})。dynamic不是函数
"$(this).tooltip({tip: "#tooltip", position: "center right", offset: [0, 15], delay: 0}).dynamic is not a function"
是因为使用$(this)???
is it because of using $(this) ???
推荐答案
问题是您尚未加载动态
函数。来自 jQuery工具文档:
The problem is that you haven't loaded the dynamic
function. From the jQuery tools documentation:
动态插件和幻灯片效果不包含在标准jQuery Tools发行版中。您必须下载自定义组合才能包含这些效果。
此外,您不需要委托
呼叫。您正在重做每次鼠标悬停时的工具提示
创建。你只需要做一次;该插件将在内部处理事件。
Furthermore, you don't need your delegate
call. You are redoing the tooltip
creation on every mouseover. You only need to do it once; the plugin will handle the events internally.
$("[id^=pane] [id^=comm]").tooltip({/*...*/})
.dynamic({/*...*/});
这将选择所有带有以 comm
开头的ID的元素这是元素的子元素,其中包含以 pane
开头的ID。请注意,为所有这些元素添加适当的类会显着加快您的选择。
This selects all elements with ids beginning comm
that are children of elements with ids beginning pane
. Note that adding appropriate classes to all these elements would speed up your selection significantly.
这篇关于jQuery Tooltip插件错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!