Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 318993
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T08:37:14+00:00 2026-05-12T08:37:14+00:00

I have seen many css switchers which place a button allowing the user to

  • 0

I have seen many css switchers which place a button allowing the user to change styles to suit their taste. I am looking for a similar solution that I have not yet found.

This is the closest: http://net.tutsplus.com/demos/03_jQueryStyleSwitcher/demo/index.php#

I want my page to fade from one style sheet to the next every x seconds, so css completely changes every x seconds. I want to do it in jquery for simplicity and some nice transitions. Again, I want this to happen AUTOMATICALLY, without the click of any button. Anybody see any code out there that can do this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T08:37:14+00:00Added an answer on May 12, 2026 at 8:37 am

    You could scavenge the code that actually loads the stylesheet and trigger it from a setInterval call instead of a button click. You’d need to supply the url for the stylesheet. This could be stored in a javascript array and you could simply rotate through the elements of the array (or pick one randomly) in the function triggered by the interval timer. You’d then advance the index (mod array size) to get the next style to display.

    var styles = [ '/example.com/css/style1.css', '/example.com/css/style2.css' ];
    var currentStyle = 0;
    
    setInterval( function() {
           currentStyle = (currentStyle + 1) % styles.length;
           loadStylesheet( currentStyle );
    }, 5000 );
    

    Update: I spent some time today converting the example into a plugin that works for me with a select. You can find the code on my blog, http://farm-fresh-code.blogspot.com/2009/08/jquery-theme-manager-plugin.html. Here’s how I would probably proceed to use it. This would work with theme1.css, theme2.css, etc. That is styles at the urls: /example.com/styles/theme1.css, …

    Script:

    var currentTheme = 0;
    var themes = $('.theme');
    themes.retheme({
       baseUrl: '/example.com/styles',
       loadingImg: '/example.com/images/image.gif'
    });
    
    setInterval( function() {
        currentTheme = (currentTheme + 1) % themes.length;
        themes.eq(currentTheme).trigger('click');
    });
    

    Html:

    <input type='hidden' class='theme' value='theme1' />
    <input type='hidden' class='theme' value='theme2' />
    <input type='hidden' class='theme' value='theme3' />
    

    Demo:

    A demo of the code using both a select and links can be found at http://myweb.uiowa.edu/timv/retheme-demo.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Many times I have seen Visual Studio solutions which have multiple projects that share
I have seen many programs consisting of structures like the one below typedef struct
I have seen many examples, with many 'no, you missed something' comments. What is
I have seen many apps that take instrument classes and take -javaagent as a
I have seen simple example Ajax source codes in many online tutorials. What I
I have seen this problem arise in many different circumstances and would like to
Haven't seen many Geneva related questions yet, I have posted this question in the
I've seen (and used) code to have a link spawn a javascript action many
I have seen examples of printing from a windows application but I have not
I have seen lots of questions recently about WPF... What is it? What does

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.