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 8031637
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T01:10:22+00:00 2026-06-05T01:10:22+00:00

So, since I have problems deciding an absolute theme for my site, I’d like

  • 0

So, since I have problems deciding an absolute theme for my site, I’d like to let the user choose a theme from a dropdown menu, and when an option is clicked, it’ll change the background image, background color, and background positioning.

eg. If the user chose the “Mario Bros 3” theme, they’d get

background-image:url('smb3.jpg');
background-repeat:repeat-x;
background-position:left bottom;
background-attachment: fixed;
background-color: #6899f8;

And if you select “Zelda LTTP” theme, you’d get

background-image:url('zeldalttp.jpg');
background-repeat:no-repeat;
background-position:left bottom;
background-attachment: fixed;
background-color: Black;

I’d like this to be in a dropdown menu, and have it remember your choice, so that it applies every time.

I have next to no idea how to do this, can anybody help?

  • 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-06-05T01:10:24+00:00Added an answer on June 5, 2026 at 1:10 am

    I’d select the themes by different classes on the body, like that:

    body.smb2{
        background-image:url('smb3.jpg');
        background-repeat:repeat-x;
        background-position:left bottom;
        background-attachment: fixed;
        background-color: #6899f8;
    }
    body.zelda{
        background-image:url('zeldalttp.jpg');
        background-repeat:no-repeat;
        background-position:left bottom;
        background-attachment: fixed;
        background-color: Black;
    }
    

    Then set the body class with javascript (or server-side) and save the choice in a cookie.


    Exactly, put the css in a css file then you could change it like that:

    HTML:

    <select id="select">
        <option value=""></option>
        <option value="smb2">SMB 2</option>
        <option value="zelda">Zelda</option>
    </select>
    

    pure JS:

    var sel = document.getElementById('select');
    sel.onchange = function(){
        document.body.className = sel.value;
    };
    

    or jQuery if you prefer:

    $('select').change(function(){
        $('body').prop('class',$(this).val());    
    });
    

    Ok the problem on your site is, that the body already has a bunch of other classes. And className overwrites all of them.
    One solution would be to save the old classes and then add the new ones like that:

    var saveclass = null;
    var sel = document.getElementById('select');
    sel.onchange = function(){
        saveclass = saveclass ? saveclass : document.body.className;
        document.body.className = saveclass + ' ' + sel.value;
    };
    

    or jQuery:

    var currentclass = null;
    $('select').change(function(){
        $('body').removeClass(currentclass).addClass($(this).val());
        currentclass = $(this).val();
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Ever since deleting the original settings.settings file I have had endless problems getting the
i have problems simulating call or sms since telnet or ddms perspective on eclipse.
I want to have some user modifiable configuration for my app. Since i am
Since I have some ocular problems and my eyes start bleeding when the display
Since I upgraded my MonoTouch to version 4, I have problems with the *.xib.designer.cs
We have a problem in our swing based application since we've upgraded our java
On a tabcontrol, I have no problem for fade in since the steps are
I seem to have a tricky problem since the latest ADT update to release
I have a big big problem. Yesterday I updated the Android SDK and, since
Hope to get solution to this problem. I have been stuck on it since

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.