the detach method on Tips doesn't destroy any elements. It just removes the tips behavior from the elements you provide.
On Mon, May 3, 2010 at 5:22 AM, hamburger <[email protected]> wrote: > Hello in my code the function > Hints.detach(li_element); > destroys the detached element (here:li_element) not the Hints. > > is this the way of meaning? > > How to destroy the showed Tip-element? > > my code: > var li_element = new Element('li', { > 'id': bildID, > 'class': 'complain', > 'html': complaintext + '<br /><span > class="time">I do not > want this ...</span>' > }).adopt( > new Element('img', { > 'class': 'complain-remove', > src: > 'images/investor_close.gif', > title: 'click to remove.', > events: { > click: function() { > > Hints.detach(li_element); //Tip > delete > li_element.dispose(); > } > } > }) > ).inject('complainContainer','top'); > > > and for tips: > > var Hints = new Tips({ > showDelay: 100, > hideDelay: 10, > offset: { > 'x': -60, > 'y': -130 > }, > fixed: true, > className: 'david_tip', > onShow: function(tip,el) { > tip.fade('in'); > }, > onHide: function(tip,el) { > tip.fade('out'); > }, > onDetach:function(tip,el) { > alert("detached"); > //tip.fade('out'); //something wrong here > //tip.setStyle('display', 'none'); > } > }); > If you want to reference the tip element you'll need to reference your Tips instance and wrap it in $(). I.e.: var myTips = new Tips(...); myTips.addEvent('detach', function(hovered){ $(myTips).fade('out'); });
