Background Color Switcher

Developer
Size
1,955 Kb
Views
18,216

How do I make an background color switcher?

Click to set the background color of the body element. Small color swatch DIVs, color completely controlled in CSS and element ID attribute is agnostic. . What is a background color switcher? How do you make a background color switcher? This script and codes were developed by Casey Hunt on 19 November 2022, Saturday.

Background Color Switcher Previews

Background Color Switcher - Script Codes HTML Codes

<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Background Color Switcher</title> <link rel="stylesheet" href="css/style.css">
</head>
<body> <div class="color-box" id="firstColor"></div>
<div class="color-box" id="secondColor"></div>
<div class="color-box" id="thirdColor"></div>
<div class="color-box" id="fourthColor"></div> <script src='http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script> <script src="js/index.js"></script>
</body>
</html>

Background Color Switcher - Script Codes CSS Codes

body { background-color: black; }
.color-box { height: 50px; width: 50px; border: 1px solid rgba(255,255,255,0.5); color: white; display: inline-block; margin-right: 2px;
}
/********************************** Box Colors
**********************************/
#firstColor { background-color: #badA55; }
#secondColor { background-color: red; }
#thirdColor { background-color: black; }
#fourthColor { background-color: lightblue; }

Background Color Switcher - Script Codes JS Codes

$(".color-box").click(function() { var idColor = $(this).css('background-color'); $('body').css('background-color', idColor);
});
Background Color Switcher - Script Codes
Background Color Switcher - Script Codes
Home Page Home
Developer Casey Hunt
Username caseymhunt
Uploaded November 19, 2022
Rating 3
Size 1,955 Kb
Views 18,216
Do you need developer help for Background Color Switcher?

Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!

Casey Hunt (caseymhunt) Script Codes
Create amazing sales emails with AI!

Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!