Checkbox

Use http://thoughtbot.github.io/

by zolotnitskiy

HTML

<label class="label-switch">
  <input type="checkbox" id="check" checked />
  <div class="checkbox"></div>
</label>

CSS

.label-switch {
  border-radius: 32px;
  cursor: pointer;
  display: inline-block;
  height: 32px;
  position: relative;
  width: 52px;
}
.label-switch input[type="checkbox"] {
  display: none;
}
.label-switch input[type="checkbox"] + .checkbox {
  -webkit-transition: all 0.3s ease;
  -moz-transition: all 0.3s ease;
  transition: all 0.3s ease;
  background: #e8e8e8;
  border-radius: 32px;
  border: none;
  cursor: pointer;
  height: 32px;
  margin: 0;
  padding: 0;
  position: relative;
  width: 52px;
  z-index: 0;
}
.label-switch input[type="checkbox"] + .checkbox:before {
  position: absolute;
  top: 2px;
  left: 2px;
  -webkit-transform: scale(1);
  -moz-transform: scale(1);
  -ms-transform: scale(1);
  -o-transform: scale(1);
  transform: scale(1);
  -webkit-transition: all 0.3s ease;
  -moz-transition: all 0.3s ease;
  transition: all 0.3s ease;
  background: white;
  border-radius: 32px;
  content: "";
  height: 28px;
  width: 48px;
  z-index: 1;
}
.label-switch input[type="checkbox"] + .checkbox:after {
  position: absolute;
  top: 2px;
  left: 2px;
  -webkit-transition: all 0.3s ease;
  -moz-transition: all 0.3s ease;
  transition: all 0.3s ease;
  width: 28px;
  height: 28px;
  background: white;
  border-radius: 28px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.4);
  content: "";
  z-index: 2;
}
.label-switch input[type="checkbox"]:checked + .checkbox {
  background: #477DCA;
}
.label-switch input[type="checkbox"]:checked + .checkbox:before {
  -webkit-transform: scale(0);
  -moz-transform: scale(0);
  -ms-transform: scale(0);
  -o-transform: scale(0);
  transform: scale(0);
}
.label-switch input[type="checkbox"]:checked + .checkbox:after {
  left: 22px;
}

JavaScript

$(document).ready(function(){
    $('#check').click(function () {
        console.log($('#check').is(':checked'));
    });
});