A Pen by CodeBlogger on CodePen.
Created
November 1, 2019 09:15
-
-
Save MrProgramerShah/c1c48e6cd9978ac37f5d98e89a29c832 to your computer and use it in GitHub Desktop.
Animation checkbox
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class='circle'> | |
<div class='circle-mood'></div> | |
<span class='line-short'></span> | |
<span class='line-long'></span> | |
</div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$('.circle-mood').click(function () { | |
$(this).toggleClass('clicked'); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.circle{ | |
width: 100px; height: 100px; | |
position: absolute; | |
top: 50%; left: 50%; | |
transform: translate(-50%,-50%); | |
} | |
.circle-mood{ | |
width: 100%; height: 100%; | |
border: 15px solid red; | |
box-sizing: border-box; | |
border-radius: 50%; | |
transition: .5s; | |
cursor: pointer; | |
} | |
.clicked{ | |
border: 50px solid green; | |
} | |
.line-short, .line-long{ | |
position: absolute; height: 10px; | |
background: white; | |
transition: .s; opacity: 0; | |
} | |
.line-short{ | |
width: 30px; top: 55px; left: 20px; | |
transform: rotate(45deg); | |
} | |
.line-long{ | |
width: 50px; top: 44px; left: 35px; | |
transform: rotate(-45deg); | |
} | |
.clicked ~ .line-long{ | |
opacity: 1 | |
} | |
.clicked ~ .line-short{ | |
opacity: 1 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment