Created
January 23, 2017 21:58
-
-
Save anonymous/107f8a4fb156c393cf0422a0c99cc567 to your computer and use it in GitHub Desktop.
JS Bin // source http://jsbin.com/zelasiw
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width"> | |
<title>JS Bin</title> | |
<style id="jsbin-css"> | |
.togglePill.togglePill-true:after { | |
background-position: 0px; | |
width: 40px; | |
animation: showhide 0.3s; | |
} | |
.togglePill.togglePill-false:after { | |
background-position: -53px; | |
width: 40px; | |
animation: hideshow 0.3s; | |
} | |
.togglePill.togglePill-true:after { | |
padding-right: 15px; | |
content: "True"; | |
} | |
.togglePill.togglePill-false:after { | |
content: "False"; | |
} | |
.togglePill { | |
background-color: #00e600; | |
width: 60px; | |
border: 2px solid #00e600; | |
border-radius: 5px; | |
box-shadow: 1px 1px 5px #888; | |
cursor: pointer; | |
color: white; | |
transition: background-color 0.3s, border-color 0.3s; | |
transition-timing-function: ease-in-out; | |
} | |
.togglePill:after { | |
border-radius: 5px; | |
background: linear-gradient(to right, #00e600 90%, white 10%); | |
background-repeat: repeat-y; | |
transition: background-position 0.3s; | |
transition-timing-function: ease-in-out; | |
padding: 0 10px; | |
} | |
.togglePill.togglePill-true { | |
background-color: #00e600; | |
border-color: #00e600; | |
} | |
.togglePill.togglePill-false { | |
background-color: red; | |
border-color: red; | |
} | |
@keyframes hideshow, | |
@keyframes showhide{ | |
0% {color: rgba(0, 230, 0, 0);} | |
89% {color: rgba(0, 230, 0, 0);} | |
90% {color: rgba(0, 230, 0, 1);} | |
} | |
</style> | |
</head> | |
<body> | |
<script src="https://code.jquery.com/jquery-3.0.0.js"></script> | |
<div class="togglePill togglePill-true"> | |
</div> | |
<script id="jsbin-javascript"> | |
$('.togglePill').click(function() { | |
$(this).toggleClass('togglePill-true') | |
.toggleClass('togglePill-false') | |
}) | |
</script> | |
<script id="jsbin-source-css" type="text/css">.togglePill.togglePill-true:after { | |
background-position: 0px; | |
width: 40px; | |
animation: showhide 0.3s; | |
} | |
.togglePill.togglePill-false:after { | |
background-position: -53px; | |
width: 40px; | |
animation: hideshow 0.3s; | |
} | |
.togglePill.togglePill-true:after { | |
padding-right: 15px; | |
content: "True"; | |
} | |
.togglePill.togglePill-false:after { | |
content: "False"; | |
} | |
.togglePill { | |
background-color: #00e600; | |
width: 60px; | |
border: 2px solid #00e600; | |
border-radius: 5px; | |
box-shadow: 1px 1px 5px #888; | |
cursor: pointer; | |
color: white; | |
transition: background-color 0.3s, border-color 0.3s; | |
transition-timing-function: ease-in-out; | |
} | |
.togglePill:after { | |
border-radius: 5px; | |
background: linear-gradient(to right, #00e600 90%, white 10%); | |
background-repeat: repeat-y; | |
transition: background-position 0.3s; | |
transition-timing-function: ease-in-out; | |
padding: 0 10px; | |
} | |
.togglePill.togglePill-true { | |
background-color: #00e600; | |
border-color: #00e600; | |
} | |
.togglePill.togglePill-false { | |
background-color: red; | |
border-color: red; | |
} | |
@keyframes hideshow, | |
@keyframes showhide{ | |
0% {color: rgba(0, 230, 0, 0);} | |
89% {color: rgba(0, 230, 0, 0);} | |
90% {color: rgba(0, 230, 0, 1);} | |
}</script> | |
<script id="jsbin-source-javascript" type="text/javascript">$('.togglePill').click(function() { | |
$(this).toggleClass('togglePill-true') | |
.toggleClass('togglePill-false') | |
})</script></body> | |
</html> |
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
.togglePill.togglePill-true:after { | |
background-position: 0px; | |
width: 40px; | |
animation: showhide 0.3s; | |
} | |
.togglePill.togglePill-false:after { | |
background-position: -53px; | |
width: 40px; | |
animation: hideshow 0.3s; | |
} | |
.togglePill.togglePill-true:after { | |
padding-right: 15px; | |
content: "True"; | |
} | |
.togglePill.togglePill-false:after { | |
content: "False"; | |
} | |
.togglePill { | |
background-color: #00e600; | |
width: 60px; | |
border: 2px solid #00e600; | |
border-radius: 5px; | |
box-shadow: 1px 1px 5px #888; | |
cursor: pointer; | |
color: white; | |
transition: background-color 0.3s, border-color 0.3s; | |
transition-timing-function: ease-in-out; | |
} | |
.togglePill:after { | |
border-radius: 5px; | |
background: linear-gradient(to right, #00e600 90%, white 10%); | |
background-repeat: repeat-y; | |
transition: background-position 0.3s; | |
transition-timing-function: ease-in-out; | |
padding: 0 10px; | |
} | |
.togglePill.togglePill-true { | |
background-color: #00e600; | |
border-color: #00e600; | |
} | |
.togglePill.togglePill-false { | |
background-color: red; | |
border-color: red; | |
} | |
@keyframes hideshow, | |
@keyframes showhide{ | |
0% {color: rgba(0, 230, 0, 0);} | |
89% {color: rgba(0, 230, 0, 0);} | |
90% {color: rgba(0, 230, 0, 1);} | |
} |
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
$('.togglePill').click(function() { | |
$(this).toggleClass('togglePill-true') | |
.toggleClass('togglePill-false') | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment