Mouseover actions are great and when combined with smooth effects, most users cannot distinguish them from flash objects.
The previous two recipes have prepared us to add effects to our mouseover, button-shows-image creation. After reviewing those two concepts of attaching the event listeners and altering unrelated DOM elements, we are ready to make the images appear in a milky smooth, moo-fashion.
Rather than making the images suddenly show up, we instantiate a moo-effect upon the DIV pic
. Using that effect object, we fade in and out the opacity of the DIV as the images are added and removed.
$$('a').addEvents({ 'mouseover':function() { // if the pic is visible, hide it fast $('pic').fade('hide'); this.setStyles({'color':'#FFF','background-position':'bottom'}); var txt = this.get('text'); this.set('text',text_changer(txt)); $('pic').setStyle('background','#FFF url(07_'+txt+'.jpg) no-repeat top left'); //...