Return to Snippet

Revision: 7353
at October 6, 2008 10:21 by fredaudet


Updated Code
window.addEvent('domready', function() {
	//preload images
	var aPreLoad = new Array();
	var aPreLoadi = 0;
	
	//do rollover
	$$('img.roll', 'input.roll').each(function(el){
		//let's preload
		aPreLoad[aPreLoadi] = new Image();
		aPreLoad[aPreLoadi].src = el.src.replace(el.src.replace('_off_', '_on_'));
		aPreLoadi++;
	
		el.addEvent('mouseover',function(){
			this.setAttribute('src',this.src.replace('_off_', '_on_'));
		});
	
		el.addEvent('mouseout',function(){
			this.setAttribute('src',this.src.replace('_on_','_off_'));
		});
	});

});


window.addEvent('domready',function() {
	$each($$('.fade'), function(el) {
		var original = el.getStyle('color');
		var morph = new Fx.Morph(el,{ 'duration':'300' });
		el.addEvents({
			'mouseenter' : function() { morph.start({ 'color':'#ff8c00' }) },
			'mouseleave' : function() { morph.start({ 'color': original }) }
		});
	});
});

Revision: 7352
at July 18, 2008 15:58 by fredaudet


Initial Code
window.addEvent('domready', function() {
	//preload images
	var aPreLoad = new Array();
	var aPreLoadi = 0;
	
	//do rollover
	$$('img.roll', 'input.roll').each(function(el){
		//let's preload
		aPreLoad[aPreLoadi] = new Image();
		aPreLoad[aPreLoadi].src = el.src.replace(el.src.replace('_off_', '_on_'));
		aPreLoadi++;
	
		el.addEvent('mouseover',function(){
			this.setAttribute('src',this.src.replace('_off_', '_on_'));
		});
	
		el.addEvent('mouseout',function(){
			this.setAttribute('src',this.src.replace('_on_','_off_'));
		});
	});

});

Initial URL

                                

Initial Description

                                

Initial Title
Mootools rollOver (no effect)

Initial Tags

                                

Initial Language
JavaScript