Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS How to toggle css stylesheets

  • This topic is empty.
Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #36323
    Justin11111
    Participant

    I have always got a kick out of csszengarden.com. I wanted to use that concept to allow a user to toggle between multiple stylesheets on my person website. Anyone know of a simple way to allow this? There must be a simple html code snippet.

    Thank you!

    #95458
    dfogge
    Participant

    have not tried it myself but this seems very easy to implement using this: http://www.kelvinluck.com/assets/jquery/styleswitch/toggle.html

    #95463
    JohnMotylJr
    Participant
    $(function()
    {
    // Call stylesheet init so that all stylesheet changing functions
    // will work.
    $.stylesheetInit();

    // This code loops through the stylesheets when you click the link with
    // an ID of "toggler" below.
    $('#toggler').bind(
    'click',
    function(e)
    {
    $.stylesheetToggle();
    return false;
    }
    );

    // When one of the styleswitch links is clicked then switch the stylesheet to
    // the one matching the value of that links rel attribute.
    $('.styleswitch').bind(
    'click',
    function(e)
    {
    $.stylesheetSwitch(this.getAttribute('rel'));
    return false;
    }
    );
    }
    );

    reference:What @df0gge said lol…

    #95465
    Justin11111
    Participant

    thanks guys. I used this thing called a search engine and found this php alternative also,
    http://www.alistapart.com/articles/phpswitch/

    #95466
    dfogge
    Participant

    search…engines? wow what will they think of next?

    #95467
    JohnMotylJr
    Participant

    i used this thing called google…!

    #95472
    JohnMotylJr
    Participant

    Also just found this here looking for some fluid positioning stuff…

    https://css-tricks.com/examples/AlternateStyleSheets/

Viewing 7 posts - 1 through 7 (of 7 total)
  • The forum ‘CSS’ is closed to new topics and replies.