Dynamic stylesheet swap with Mootools 1.2

Thanks to Mootools (my favorite JS Framework), it is possible to change the current CSS stylesheet dynamically really easily :

The Head :



The Body :


The JS:

$('styleSelector').addEvent('change',function(){
	var sexyColor = new Asset.css(this.value+'.css',{'id':'colorStyleSheet'});
	sexyColor.replaces(window.document.head.getElementById('colorStyleSheet'));
})

Leave a Reply

Your email address will not be published. Required fields are marked *