Created
July 5, 2012 16:56
Checkbox Slider
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
/** | |
* Checkbox Slider | |
*/ | |
input[type=checkbox] { | |
visibility: hidden; | |
} | |
.form_slider { | |
position: relative; | |
width: 33px; | |
height: 9px; | |
background: #f5f5f4; | |
margin:20px 0 40px 10px; | |
-webkit-border-radius: 50px; | |
-moz-border-radius: 50px; | |
border-radius: 50px; | |
-webkit-box-shadow: inset 0px 1px 1px rgba(0,0,0,0.5), 0px 1px 0px rgba(255,255,255,0.2); | |
-moz-box-shadow: inset 0px 1px 1px rgba(0,0,0,0.5), 0px 1px 0px rgba(255,255,255,0.2); | |
box-shadow: inset 0px 1px 1px rgba(0,0,0,0.5), 0px 1px 0px rgba(255,255,255,0.2); | |
} | |
.form_slider label { | |
position:absolute; | |
left:50px; | |
width:400px; | |
top:-9px; | |
font-size:18px; | |
} | |
.form_slider label:before { | |
content:''; | |
position:absolute; | |
width: 17px; | |
height: 17px; | |
left:-50px; | |
top:4px; | |
cursor: pointer; | |
position: absolute; | |
z-index: 1; | |
-webkit-border-radius: 50px; | |
-moz-border-radius: 50px; | |
border-radius: 50px; | |
-webkit-transition: all .4s ease; | |
-moz-transition: all .4s ease; | |
-o-transition: all .4s ease; | |
-ms-transition: all .4s ease; | |
transition: all .4s ease; | |
-webkit-box-shadow: 0px 2px 5px 0px rgba(0,0,0,0.3); | |
-moz-box-shadow: 0px 2px 5px 0px rgba(0,0,0,0.3); | |
box-shadow: 0px 2px 5px 0px rgba(0,0,0,0.3); | |
background: #cfd0cb; | |
background: -webkit-linear-gradient(top, #cfd0cb 0%, #9a9a97 100%); | |
background: -moz-linear-gradient(top, #cfd0cb 0%, #9a9a97 100%); | |
background: -o-linear-gradient(top, #cfd0cb 0%, #9a9a97 100%); | |
background: -ms-linear-gradient(top, #cfd0cb 0%, #9a9a97 100%); | |
background: linear-gradient(top, #cfd0cb 0%, #9a9a97 100%); | |
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#459fa6', endColorstr='#9a9a97',GradientType=0 ); | |
} | |
.form_slider label:after { | |
content: ''; | |
position: absolute; | |
background: #f5f5f4; | |
width: 5px; | |
height: 5px; | |
left:-44px; | |
top:9px; | |
z-index:2; | |
-webkit-border-radius: 50px; | |
-moz-border-radius: 50px; | |
border-radius: 50px; | |
-webkit-box-shadow: inset 0px 1px 1px rgba(0,0,0,0.7), 0px 1px 0px rgba(255,255,255,0.9); | |
-moz-box-shadow: inset 0px 1px 1px rgba(0,0,0,0.7), 0px 1px 0px rgba(255,255,255,0.9); | |
box-shadow: inset 0px 1px 1px rgba(0,0,0,0.7), 0px 1px 0px rgba(255,255,255,0.9); | |
} | |
.form_slider label span { | |
display:inline-block; | |
position:relative; | |
top:-17px; | |
width:30px; | |
} | |
.form_slider label span:before { | |
content:'Off'; | |
position:absolute; | |
color:#999999; | |
font-size:10px; | |
text-transform:uppercase; | |
left:-7px; | |
top:7px; | |
} | |
.form_slider input[type=checkbox]:checked + label:before { | |
left:-34px; | |
-webkit-box-shadow: 0px 2px 5px 0px rgba(0,0,0,0.3); | |
-moz-box-shadow: 0px 2px 5px 0px rgba(0,0,0,0.3); | |
box-shadow: 0px 2px 5px 0px rgba(0,0,0,0.3); | |
background: #459fa6; | |
background: -webkit-linear-gradient(top, #459fa6 0%, #26585f 100%); | |
background: -moz-linear-gradient(top, #459fa6 0%, #26585f 100%); | |
background: -o-linear-gradient(top, #459fa6 0%, #26585f 100%); | |
background: -ms-linear-gradient(top, #459fa6 0%, #26585f 100%); | |
background: linear-gradient(top, #459fa6 0%, #26585f 100%); | |
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#459fa6', endColorstr='#26585f',GradientType=0 ); | |
} | |
.form_slider input[type=checkbox]:checked + label:after { | |
left:-28px; | |
} | |
.form_slider input[type=checkbox]:checked + label + span:before { | |
content:'On'; | |
} | |
.form_slider input[type=checkbox] + label span:after { | |
opacity:1; | |
position:absolute; | |
left:-7px; | |
top:2px; | |
width:30px; | |
content:'\2713'; | |
background:#ffffff; | |
color:#8cb40d; | |
} | |
.form_slider input[type=checkbox]:checked + label span:after { | |
-webkit-transition: opacity 1s linear 3s; | |
-moz-transition: opacity 1s linear 3s; | |
-ms-transition: opacity 1s linear 3s; | |
-o-transition: opacity 1s linear 3s; | |
transition: opacity 1s linear 3s; | |
opacity:0; | |
} | |
.form_slider input[type=checkbox]:checked + label span.hide:after { | |
display:none; | |
} |
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
<!-- content to be placed inside <body>…</body> --> | |
<div class="form_slider"> | |
<input type="checkbox" value="None" id="slideOne" name="check" checked /> | |
<label for="slideOne"><span class="status"></span>Makes a change to a proposal I created</label> | |
</div> | |
<div class="form_slider"> | |
<input type="checkbox" value="None" id="slideTwo" name="check" /> | |
<label for="slideTwo"><span class="status"></span>Makes a change to a proposal I created</label> | |
</div> | |
<div class="form_slider"> | |
<input type="checkbox" value="None" id="slideThree" name="check" /> | |
<label for="slideThree">Edits a proposal I created</label> | |
</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
{"view":"split","fontsize":"100","seethrough":"","prefixfree":"1","page":"all"} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment