javascript - Jquery Tooltip plugin, don't repeat div append? -
ok, can't see this.
i'm making tooltip plugin can applied multiple items.
i have multiple anchors on page when mousedover act tooltips. use variable c_ttip act identifier div because don't want set id on it.
i want keep appending tooltip , applying class , css on , on if same anchor remoused on before tooltip mouseout activates timeout removes it.
script dev page, http://kalluna.com/_dev-js.do
var c_ttip = $('<div>'); return this.each(function() { $(this).mouseover(function() { c_ttip.appendto(document.body).hide(); c_ttip.html('inside tooltip').addclass('c_ttip_box').css({'top' : obj.position().top + 20, 'left' : obj.position().left}).show(); }).mouseout(function() { timer = settimeout(function() { c_ttip.fadeout(200, function() { c_ttip.remove();}); }, 2000); }); });
you can store object triggered tooltip , verify object different before adding div. like:
var c_ttip = $('<div>'); var currobject; ... $(this).mouseover(function() { if(this == currobject) return; currobject = this; ...
Comments
Post a Comment