Color Picker
How do I make an color picker?
Learning jQuery, my attempt at making color picker for an online store module.. What is a color picker? How do you make a color picker? This script and codes were developed by Tim Normington on 05 December 2022, Monday.
Color Picker - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Color Picker</title> <script type="text/javascript" src="https://code.jquery.com/jquery-1.10.2.js"></script>
<link type="text/css" rel="stylesheet" href="https://github.com/component/dropdown/blob/1cc94081da2664087c0e4407f5b67dfe3eff898a/dropdown.css" />
<script type="text/javascript" src="https://github.com/twbs/bootstrap/blob/3487898a6af8c1d5b12f7b040d30e71b19e34923/js/dropdown.js"></script>
<script type="text/javascript" src="https://github.com/component/menu/blob/dc4bec3dc1b74d912a9d5b26fcc9ab3e04555535/index.js"></script> <link rel="stylesheet" href="css/style.css">
</head>
<body>
<div class="container"> <h3> Choose a color </h3> <div class="color-picker"> <button class="swatch swatch_red"> </button> <button class="swatch swatch_blue"> </button> <button class="swatch swatch_green"> </button> <button class="swatch swatch_brown"> </button> <button class="swatch swatch_yellow"> </button> <button class="swatch swatch_purple"> </button> </div> <div class="size-module"> <h3> Choose a size </h3> <label for="size"></label> <select name="size" id="size"> <option value="5">5</option> <option value="5.5">5.5</option> <option value="6">6</option> <option value="6.5">6.5</option> <option value="7">7</option> </select> </div> <div id="hat-viewport"> <img src="http://www.thetimnormington.com/img/storage/hat.svg" alt="Hat"> <button id="design-btn"> <h4> Choose a design </h4> </button> </div>
</div> <script src="js/index.js"></script>
</body>
</html>
Color Picker - Script Codes CSS Codes
@import url(https://fonts.googleapis.com/css?family=Open+Sans:800);
* { margin: 0; padding: 0;
}
div {
}
.swatch_red { background-color: red;
}
.swatch_blue { background-color: blue;
}
.swatch_green { background-color: green;
}
.swatch_brown { background-color: brown;
}
.swatch_yellow { background-color: yellow;
}
.swatch_purple { background-color: purple;
}
.swatch { width: 50px; height: 50px; display: block; border: none; -webkit-filter: drop-shadow(0 0 0 rgba(0,0,0,0.5)) opacity(0.5); filter: drop-shadow(0 0 0 rgba(0,0,0,0.5)) opacity(.2);
}
.hover { -webkit-filter: drop-shadow(0 0 3px rgba(0,0,0,0.5)) opacity(1); filter: drop-shadow(0 0 3px rgba(0,0,0,0.5)) opacity(1);
}
.swatch, #size-btn:active { border: 2px solid black;
}
.swatch, #size-btn:focus { border: none; outline: 0;
}
.container { max-width: 300px; margin: auto;
}
.container h3 { display: flex; align-items: center; justify-content: center; width: 100%; height: 50px; color: #FFF; background-color: #777; font-family: Open Sans, Sans Serif; font-size: 30px;
}
.color-picker { display: flex; justify-content: space-between; padding-bottom: 20px;
}
.size-module { display: flex; align-items: center;
}
#size-btn { tab-index: 0; border: none; box-sizing: border-box; height: 50px; min-width: 50px; background-image: url(http://www.thetimnormington.com/img/storage/ruler.svg); background-repeat: no-repeat; background-position: center; background-size: fit; -webkit-filter: drop-shadow(0 0 0 #fff) opacity(.5); transition: all .3s ease-in;
}
#size-btn:hover { -webkit-filter: drop-shadow(1px 1px 2px rgba(0,0,0,0.5)) opacity(1);
}
#size { height: 50px; font-family: Open Sans; font-size: 26px; color: #fff; background-color: #777; border: none;
}
#design-btn { border-radius: 5px; font-size: 30px; font-family: Open Sans, Sans Serif; height: 100px; padding: 0px 15px 0px 15px; position: relative; top: -170px; left: 10px; -webkit-filter: opacity(0); transition: all .3s ease-in;
}
#hat-viewport img { -webkit-filter: grayscale(1) brightness(4);
}
Color Picker - Script Codes JS Codes
$(document).ready(function() { $('.swatch').mouseover(function() { $(this).addClass('hover'); }); $('.swatch').mouseout(function() { $(this).removeClass('hover'); }); $('.swatch_red').click(function() { $('img').css('-webkit-filter','grayscale(0) hue-rotate(120deg)'); }); $('.swatch_blue').click(function() { $('img').css('-webkit-filter','grayscale(0) hue-rotate(0deg)'); }); $('.swatch_green').click(function() { $('img').css('-webkit-filter','grayscale(0) hue-rotate(-75deg)'); }); $('.swatch_brown').click(function() { $('img').css('-webkit-filter','grayscale(.75) hue-rotate(135deg)'); }); $('.swatch_yellow').click(function() { $('img').css('-webkit-filter','grayscale(0) hue-rotate(190deg) brightness(4)'); }); $('.swatch_purple').click(function() { $('img').css('-webkit-filter','grayscale(0) hue-rotate(45deg)'); });
});
Developer | Tim Normington |
Username | tnormington |
Uploaded | December 05, 2022 |
Rating | 3 |
Size | 2,956 Kb |
Views | 12,144 |
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 |
Image gallery | 2,434 Kb |
Parellelogram Link Hover Effect | 2,618 Kb |
Tri-column slanted hero with hover effect | 2,912 Kb |
Expanding Circle Menu | 4,753 Kb |
A Pen by Tim Normington | 1,949 Kb |
SVG Coffee Animation | 4,174 Kb |
Twitch Notification Concept | 2,589 Kb |
Animate Dom Manipulation | 3,205 Kb |
Modular Sassy Flex Navigation | 5,276 Kb |
JQuery Social Media Ribbon Links | 3,904 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 |
Vertical Pan Hammer.js example | Jtangelder | 2,144 Kb |
Multi-step GSAP animation | Acacheung | 2,668 Kb |
OnScreenAction | Ozgursagiroglu | 2,647 Kb |
Fading gradient button | Insprd | 1,713 Kb |
Mega Menu by Joni | Asakasinsky | 3,171 Kb |
Importable Clearfix | Corysimmons | 1,411 Kb |
SlideupBoxes | Gavra | 23,772 Kb |
APortfolio | Skybutterfly | 5,174 Kb |
Clock with full screen background | Owebboy | 2,415 Kb |
CSS Link Icons with jQuery Titles | Nicwinn | 2,312 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!