Pure CSS Shiny animated checkboxes
Instead of creating a directive or jquery plugin, creating a silky looking checkbox can simply be done using :checked + whatever {}
by halirgb
HTML
<label class="switch"><input type="checkbox" checked><i></i></label>
CSS
@import url(http://fonts.googleapis.com/css?family=Open+Sans);
.switch input {
display: none;
}
.switch i {
display: inline-block;
cursor: pointer;
padding-right: 8px;
transition: all ease 0.2s;
-webkit-transition: all ease 0.2s;
border-radius: 20px;
box-shadow: inset 0 0 1px rgba(0,0,0,.5);
font-family: 'Open Sans', sans-serif;
font-style:normal;
}
.switch i:after {
content:"Off";
float:right;
font-size:14px;
margin: 1px 5px 0 5px;
color:#AAAAAA;
}
.switch i:before {
display: inline-block;
content: ' ';
width: 20px;
height: 20px;
border-radius: 20px;
background: white;
box-shadow: 0 1px 2px rgba(0,0,0,.5);
margin-bottom:-3px;
}
.switch :checked + i {
padding-right: 0;
padding-left: 8px;
box-shadow: inset 0 0 1px rgba(0,0,0,.5), inset 0 0 40px #2ECC40;
-webkit-box-shadow: inset 0 0 1px rgba(0,0,0,.5), inset 0 0 40px #2ECC40;
}
.switch :checked + i:after{
content:"On";
float:left;
color:#48854f;
}