Background Color Switcher
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 - 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);
});
Developer | Casey Hunt |
Username | caseymhunt |
Uploaded | November 19, 2022 |
Rating | 3 |
Size | 1,955 Kb |
Views | 18,216 |
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!
Name | Size |
Headroom.js Test | 2,298 Kb |
Super cool hover section links | 3,317 Kb |
JQuery Time Range Slider | 3,055 Kb |
Shaun Spills | 2,770 Kb |
CSS Dot Leaders | 2,803 Kb |
IOS Style Underline | 2,414 Kb |
Neural Colors | 4,213 Kb |
RoundUp Rumble 2015 | 6,519 Kb |
Spotlight Animation | 1,811 Kb |
Cool Form Labels | 1,716 Kb |
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!
Name | Username | Size |
Slick Slider | Wearebold | 5,913 Kb |
SVG Basics | HipsterBrown | 1,852 Kb |
Flat iOS 7 Safari Icon | Rss | 3,332 Kb |
Compare resources on mobile sites | Gyusza | 3,226 Kb |
Fading gradient button | Insprd | 1,713 Kb |
Gradients | Karpovsystems | 2,394 Kb |
Revolving Text Landing Page Trial | TimRuby | 2,976 Kb |
Hovers with popups | Zacharyolson | 2,380 Kb |
Svg animation draw | SzymonDziewonski | 5,545 Kb |
Collapsing Widget | Er40 | 4,279 Kb |
Surf anonymously, prevent hackers from acquiring your IP address, send anonymous email, and encrypt your Internet connection. High speed, ultra secure, and easy to use. Instant setup. Hide Your IP Now!