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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T17:54:09+00:00 2026-05-31T17:54:09+00:00

I want to create a switching button with movable action like if it’s showing

  • 0

I want to create a switching button with movable action like if it’s showing on dark side it’s should dark and if it’s show light side. Can any body help with how this could be written
.

enter image description here

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javascript" src="js/jquery-1.7.1.min.js"></script>
<script type="text/javascript">

$(document).ready(function(){
$(".styleswitch").click(function() {
    $('link[rel=stylesheet]').attr('href' , $(this).attr('rel')); 
  });
});
  </script>
<link rel="stylesheet" type="text/css" href="css/dark.css" />
<title>Switch Theme</title>
</head>

<body>
<a href="#" class="styleswitch" rel="css/dark.css">Dark</a>
<a href="#" class=" styleswitch " rel="css/light.css">Light</a>
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
<div id="module-a"><a href="#" class="styleswitch" rel="css/dark.css">Dark</a>
<a href="#" class=" styleswitch " rel="css/light.css">Light</a></div>
<div id="module-b">Module1</div>
<div id="module-c">Module1</div>
<div id="module-d">Module1</div>
</body>
</html>
  • 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-31T17:54:10+00:00Added an answer on May 31, 2026 at 5:54 pm

    You can try this: – I fond this in some place..

    $j("#button1").live('click',function(){  
        //Fade out form if shown and fade in form selected
        $jtest2.fadeOut("slow", function(){
             $jtest1.fadeIn("slow");  
        });
    
        //The following is inside the click so I do not get added until the first click 
        //and added after every click so I multiply! 
        //Hence why it takes 2 clicks
    
        $j('#button1').live('click', function(){
            //change class from light to dark
            $j(this).addClass('dark_button').removeClass('light_button');
        }); //I need to change this class to light if
            // button 2 is selected and change button 2 to dark
    });
    

    you can also try this :–

    $j("#button1, #button2").live('click',
        function(){  
    
            //figure out what button was clicked. 
            if(this.id === "button1"){
                var btnA = $j(this);
                var btnB = $j("#button2");
                var divA = $j('#test1');
                var divB = $j('#test2');
            }
            else{
                btnA = $j(this);
                btnB = $j("#button1");
                divA = $j('#test2');
                divB = $j('#test1');
            }
    
            //make sure it is not already active, no use to show/hide when it is already set
            if(btnA.hasClass('dark_button')){
                return; 
            }
    
            //see if div is visible, if so hide, than show first div
            if(divB.is(":visible")){        
                divB.fadeOut("slow", function(){
                     divA.fadeIn("slow");
                });
            }
            else{//if already hidden, just show the first div
                divA.fadeIn("slow");            
            }
    
            //Add and remove classes to the buttons to switch state
            btnA.addClass('dark_button').removeClass('light_button');
            btnB.removeClass('dark_button').addClass('light_button');
        }    
    );
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to create a client side mail creator web page. I know the
I want to create my Rails application with MySQL, because I like it so
I have a problem with switching images in android. I want to create animation
I want to create a shortcut similar to Ctrl+Shift+T in Idea. Instead of switching
I basically want to create an Eclipse workspace that can be accessed between accounts
I want create a drop shadow around the canvas component in flex. Technically speaking
I want create a excel with Apache POI in java and I must insert
i want create image animation , i have 50 images with png format now
I want to create a Java application bundle for Mac without using Mac. According
I want to create a function that performs a function passed by parameter on

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.