How to create a mootool tooltip with Ajax response -
how create mootool tooltip ajax response.anybody can please suggest me tutorial same.
what have tried far?
you way btw:
set inside parent
tippable elements data-attribute store url (needed retrieve tooltip ajax) i.e.:
<div class="tippable" data-tipurl="/some/url/"> when mouseover here, tip appears </div>
then, js, create , cache tips i.e.:
$$('div.tippable').each(function(tippable){ tippable.addevents({ 'mouseenter' : function(){ if(!this.retrieve('tip')){ //first time, build tip! var tip = new element('div.tip'); tip.set('load',{/* options */}); tip.load(this.get('data-tipurl')); //get through ajax tip.inject(this, 'top').setstyles({ //set tip style position : 'absolute' /* etc... */ }); this.store('tip', tip); //store inside parent }else{ // built, show this.retrieve('tip').setstyle('display', 'block'); } }, 'mouseleave' : function(){ var tip = this.retrieve('tip'); //retrieve tip if(tip){ //if it's built, hide tip.setstyle('display','none'); } //otherwise, nothing } }); });
Comments
Post a Comment