Switching

Size
2,771 Kb
Views
36,432

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 Previews

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; }
}
Switching - Script Codes
Switching - Script Codes
Home Page Home
Developer Mojtaba Seyedi
Username seyedi
Uploaded July 27, 2022
Rating 4
Size 2,771 Kb
Views 36,432
Do you need developer help for Switching?

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!

Mojtaba Seyedi (seyedi) Script Codes
Create amazing captions 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!