如何使用Ajax响应创建mootool工具提示
如何创建带有Ajax响应的mootool工具提示。任何人都可以为我推荐一个相同的教程。到目前为止,您尝试了什么 你可以这样做,顺便说一句: 在父级如何使用Ajax响应创建mootool工具提示,ajax,mootools,tooltip,Ajax,Mootools,Tooltip,如何创建带有Ajax响应的mootool工具提示。任何人都可以为我推荐一个相同的教程。到目前为止,您尝试了什么 你可以这样做,顺便说一句: 在父级中设置可提示元素a以存储url(通过ajax检索工具提示所需),即: 请注意,您可以使用MooTools的提示类。@Kyathi不客气;)@奥斯卡,这只是构建“ajax工具提示系统”的起点;) <div class="tippable" data-tipurl="/some/url/"> when I mouseover here, a
中设置可提示元素a以存储url(通过ajax检索工具提示所需),即:
请注意,您可以使用MooTools的提示
类。@Kyathi不客气;)@奥斯卡,这只是构建“ajax工具提示系统”的起点;)
<div class="tippable" data-tipurl="/some/url/">
when I mouseover here, a tip appears
</div>
$$('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 it inside the parent
}else{ // already built, just show it
this.retrieve('tip').setStyle('display', 'block');
}
},
'mouseleave' : function(){
var tip = this.retrieve('tip'); //retrieve the tip
if(tip){ //if it's already built, hide it
tip.setStyle('display','none');
}
//otherwise, do nothing
}
});
});