Switching
How do I make an switching?
Using checkbox. What is a switching? How do you make a switching? This script and codes were developed by Mojtaba Seyedi on 27 July 2022, Wednesday.
Switching - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Switching</title> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/meyer-reset/2.0/reset.min.css"> <style> /* NOTE: The styles were added inline because Prefixfree needs access to your styles and they must be inlined if they are on local disk! */ body { background : #1b1b1b;
}
.toggle , .toggle1{ cursor : pointer; display : block; width : 130px; height : 130px; position: relative;
}
.toggle { float : left; margin: 30px 0 0 400px;
}
.toggle1 { float : right; margin: 30px 400px 0 0;
}
.a , .b{ position : absolute; top : 0; left : 0; width : 130px; height: 130px; background : #b1bb1b; text-align : center; font-size : 90px; line-height : 130px; font-family : georgia; font-weight : bold; color : #1b1b1b; border-radius : 15px; border : 2px dotted rgba(0,0,0,.5); text-shadow : 1px 1px 0 rgba(250, 250, 250, 0.5);
}
.a { z-index : 1;
}
.b { background : #b1bbfb; z-index : 2;
}
#switch , #switch1 { position: absolute; left: -9999px;
}
#switch:checked ~ .toggle .b { animation : move-r 1s both;
}
#switch:not(:checked) ~ .toggle .b{ animation : move-l 1s both;
}
@keyframes move-r { 40% { transform : rotate(500deg) scale(1.1); left : 130%; } 100% { left : 0; z-index : -1; }
}
@keyframes move-l { 0% { -webkit-transform : rotate(0deg); left : 0; z-index : -1; } 50% { transform : rotate(900deg) scale(.6); left : -130%; z-index : -1; } 100% { left : 0; z-index : 2; }
}
/* toggle1 */
#switch1:checked ~ .toggle1 .b { animation : move 1s both;
}
#switch1:checked ~ .toggle1 .a { animation : face 1s both;
}
#switch1:not(:checked) ~ .toggle1 .a{ animation : move 1s both;
}
#switch1:not(:checked) ~ .toggle1 .b{ animation : face 1s both;
}
@keyframes move { 0% { z-index : 3; } 50% { transform : rotate(15deg) scale(.6); left : 130%; z-index : 3; } 100% { left : 0; z-index : 0; }
}
@keyframes face { to { z-index : 3; }
} </style> <script src="https://cdnjs.cloudflare.com/ajax/libs/prefixfree/1.0.7/prefixfree.min.js"></script>
</head>
<body> <input type="checkbox" id="switch"/>
<label class="toggle" for="switch"> <div class="a">♣</div> <div class="b">☺</div>
</label>
<input type="checkbox" id="switch1"/>
<label class="toggle1" for="switch1"> <div class="a">☺</div> <div class="b">♥</div>
</label>
</body>
</html>
Switching - Script Codes CSS Codes
body { background : #1b1b1b;
}
.toggle , .toggle1{ cursor : pointer; display : block; width : 130px; height : 130px; position: relative;
}
.toggle { float : left; margin: 30px 0 0 400px;
}
.toggle1 { float : right; margin: 30px 400px 0 0;
}
.a , .b{ position : absolute; top : 0; left : 0; width : 130px; height: 130px; background : #b1bb1b; text-align : center; font-size : 90px; line-height : 130px; font-family : georgia; font-weight : bold; color : #1b1b1b; border-radius : 15px; border : 2px dotted rgba(0,0,0,.5); text-shadow : 1px 1px 0 rgba(250, 250, 250, 0.5);
}
.a { z-index : 1;
}
.b { background : #b1bbfb; z-index : 2;
}
#switch , #switch1 { position: absolute; left: -9999px;
}
#switch:checked ~ .toggle .b { animation : move-r 1s both;
}
#switch:not(:checked) ~ .toggle .b{ animation : move-l 1s both;
}
@keyframes move-r { 40% { transform : rotate(500deg) scale(1.1); left : 130%; } 100% { left : 0; z-index : -1; }
}
@keyframes move-l { 0% { -webkit-transform : rotate(0deg); left : 0; z-index : -1; } 50% { transform : rotate(900deg) scale(.6); left : -130%; z-index : -1; } 100% { left : 0; z-index : 2; }
}
/* toggle1 */
#switch1:checked ~ .toggle1 .b { animation : move 1s both;
}
#switch1:checked ~ .toggle1 .a { animation : face 1s both;
}
#switch1:not(:checked) ~ .toggle1 .a{ animation : move 1s both;
}
#switch1:not(:checked) ~ .toggle1 .b{ animation : face 1s both;
}
@keyframes move { 0% { z-index : 3; } 50% { transform : rotate(15deg) scale(.6); left : 130%; z-index : 3; } 100% { left : 0; z-index : 0; }
}
@keyframes face { to { z-index : 3; }
}
Developer | Mojtaba Seyedi |
Username | seyedi |
Uploaded | July 27, 2022 |
Rating | 4 |
Size | 2,771 Kb |
Views | 36,432 |
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 |
Button | 3,688 Kb |
Flock Login | 3,145 Kb |
Funny toggle switch | 2,896 Kb |
Toggle menu | 2,279 Kb |
A Pen by Mojtaba Seyedi | 3,285 Kb |
Centering anything horizontally | 2,018 Kb |
FUN | 3,508 Kb |
Navigation | 3,699 Kb |
Flat Navigation | 2,707 Kb |
Ribbon Menu | 3,773 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 |
Hard-Stop Gradients | Mackdoyle | 2,288 Kb |
Haml Calendar | Katydecorah | 5,643 Kb |
Plotting Points with D3.js | Laurakelly | 31,996 Kb |
Loader | MikitaLisavets | 3,321 Kb |
Toolbar | Onsen | 5,414 Kb |
Hover Animation from UNIQLO | Insprd | 3,772 Kb |
Flexbox slider | Rendro | 3,459 Kb |
Blackberry Mock | Zacharyolson | 1,865 Kb |
Slim Grid SASS SCSS v3.2 | Thesturs | 4,709 Kb |
Glowing Pulse Form | Jackrugile | 2,542 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!