jQuery .live() used with hover plugin
I'm using the jQueryTools tooltip plugin in my app. This plugin has its own hover function, obviously, to create the t开发者_Go百科ool tip. The plugin assumes the next element in the DOM to be the content for the tooltip, which doesn't work for me, so I'm adding the element on the fly. This element is removed on mouseout. This all works great the first time, but when the element is removed from the DOM the next time you hover over the trigger, the plug in can't find it and doesn't fire.
tl;dr - how do I apply jQuery's live() to a plugin which has its own mouseEvent?
jQueryTools Tooltip
$('.help').hover(
function() {
$('<div class="tooltip">sup</div>').insertAfter(this);
},
function() {
$(this).next("div.tooltip").remove();
}
);
$('.help').tooltip();
I think you are confusing a bit jQuery with your setup but that works:
$('.help').hover(
function() {
if($(this).next("div.tooltip").length==0){
$('<div class="tooltip">sup</div>').insertAfter(this);
}},
function() {
}
);
$('.help').tooltip();
Good luck
精彩评论