jQuery Simple Style Switcher

    [javascript]
    /** @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;
    });
    });
    [/javascript]

    Leave a Reply