Return to Snippet

Revision: 4570
at January 10, 2008 07:20 by 1man


Initial Code
/** @id sipleSwitcher
* @classDescription Very simple style switcher using jQuery
*/
$(document).ready(function(){
	$('#styleSwitch .button').bind('click', function(){
		$('body').removeClass();//remove all the other classes
		$('#styleSwitch .button').removeClass('selected');
		$(this).addClass('selected');
		switch(this.id){
			case 'style1':
				$('body').addClass('style1');
				break;
			case 'style2':
				$('body').addClass('style2');
				break;
			case 'style3':
				$('body').addClass('style3');
				break;
		}
		return false;
	});
});

Initial URL


Initial Description
Very simple style switcher using jquery. Takes 3 links with id's on each. When one is clicked various styles are removed, then a new one is added.

Initial Title
jQuery Simple Style Switcher

Initial Tags
style, jquery

Initial Language
JavaScript