Posts Tagged ‘dynamic’

Dynamic stylesheet swap with Mootools 1.2

Sunday, January 17th, 2010

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'));
})