"Fancy Bootstrap Checkboxes"
Bootstrap 3.3.0 Snippet by rawbenny

<link href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.0/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css"> <script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.0/js/bootstrap.min.js"></script> <script src="//code.jquery.com/jquery-1.11.1.min.js"></script> <!------ Include the above in your HEAD tag ----------> <div class="container"> <div class="[ row ]"> <div class="panel-group" id="accordion" role="tablist" aria-multiselectable="true"> <div class="panel panel-default"> <div class="panel-heading" role="tab" id="headingOne"> <h4 class="panel-title"> <!--<a data-toggle="collapse" data-parent="#accordion" href="#collapseOne" aria-expanded="true" aria-controls="collapseOne">--> <div class="[ form-group ]" style=""> <input type="checkbox" name="fancy-checkbox-default" id="fancy-checkbox-default-2" autocomplete="off" /> <div class="[ btn-group ]"> <label for="fancy-checkbox-default-2" class=""> <div class="rounded checked"><span class="[ glyphicon glyphicon-ok ]"></span></div> <div class="rounded unchecked"><span> </span></div> </label> <label for="fancy-checkbox-default-2" class=""> Default Checkbox </label> </div> </div> <!-- </a>--> </h4> </div> <div id="collapseOne" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingOne"> <div class="panel-body"> Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor, sunt aliqua put a bird on it squid single-origin coffee nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident. Ad vegan excepteur butcher vice lomo. Leggings occaecat craft beer farm-to-table, raw denim aesthetic synth nesciunt you probably haven't heard of them accusamus labore sustainable VHS. </div> </div> </div> </div> </div> </div> <div class="container"> <div class="[ col-xs-12 col-sm-6 ]"> <h3>Standard Checkboxes</h3><hr /> <div class="[ form-group ]" style="background:cyan;height:200px;"> <input type="checkbox" name="fancy-checkbox-default" id="fancy-checkbox-default" autocomplete="off" /> <div class="[ btn-group ]"> <label for="fancy-checkbox-default" class=""> <div class="rounded checked"><span class="[ glyphicon glyphicon-ok ]"></span></div> <div class="rounded unchecked"><span> </span></div> </label> <label for="fancy-checkbox-default" class=""> Default Checkbox </label> </div> </div> <div class="[ form-group ]"> <input type="checkbox" name="fancy-checkbox-default-2" id="fancy-checkbox-default-2" autocomplete="off" /> <div class="[ btn-group ]"> <label for="fancy-checkbox-default-2" class=""> <div class="is-urgent">Urgent?</div> <div class="urgent text-uppercase">Urgent</div> </label> </div> </div> <div class="[ form-group ]"> <input type="checkbox" name="fancy-checkbox-warning" id="fancy-checkbox-warning" autocomplete="off" /> <div class="[ btn-group ]"> <label for="fancy-checkbox-warning" class="[ btn btn-warning ]"> <span class="[ glyphicon glyphicon-ok ]"></span> <span> </span> </label> <label for="fancy-checkbox-warning" class="[ btn btn-default active ]"> Warning Checkbox </label> </div> </div> <div class="[ form-group ]"> <input type="checkbox" name="fancy-checkbox-danger" id="fancy-checkbox-danger" autocomplete="off" /> <div class="[ btn-group ]"> <label for="fancy-checkbox-danger" class="[ btn btn-danger ]"> <span class="[ glyphicon glyphicon-ok ]"></span> <span> </span> </label> <label for="fancy-checkbox-danger" class="[ btn btn-default active ]"> Danger Checkbox </label> </div> </div> </div> <div class="[ col-xs-12 col-sm-6 ]"> <h3>Custom Icons Checkboxes</h3><hr /> <div class="[ form-group ]"> <input type="checkbox" name="fancy-checkbox-default-custom-icons" id="fancy-checkbox-default-custom-icons" autocomplete="off" /> <div class="[ btn-group ]"> <label for="fancy-checkbox-default-custom-icons" class="[ btn btn-default ]"> <span class="[ glyphicon glyphicon-plus ]"></span> <span class="[ glyphicon glyphicon-minus ]"></span> </label> <label for="fancy-checkbox-default-custom-icons" class="[ btn btn-default active ]"> Default Checkbox </label> </div> </div> <div class="[ form-group ]"> <input type="checkbox" name="fancy-checkbox-primary-custom-icons" id="fancy-checkbox-primary-custom-icons" autocomplete="off" /> <div class="[ btn-group ]"> <label for="fancy-checkbox-primary-custom-icons" class="[ btn btn-primary ]"> <span class="[ glyphicon glyphicon-plus ]"></span> <span class="[ glyphicon glyphicon-minus ]"></span> </label> <label for="fancy-checkbox-primary-custom-icons" class="[ btn btn-default active ]"> Primary Checkbox </label> </div> </div> <div class="[ form-group ]"> <input type="checkbox" name="fancy-checkbox-success-custom-icons" id="fancy-checkbox-success-custom-icons" autocomplete="off" /> <div class="[ btn-group ]"> <label for="fancy-checkbox-success-custom-icons" class="[ btn btn-success ]"> <span class="[ glyphicon glyphicon-plus ]"></span> <span class="[ glyphicon glyphicon-minus ]"></span> </label> <label for="fancy-checkbox-success-custom-icons" class="[ btn btn-default active ]"> Success Checkbox </label> </div> </div> <div class="[ form-group ]"> <input type="checkbox" name="fancy-checkbox-info-custom-icons" id="fancy-checkbox-info-custom-icons" autocomplete="off" /> <div class="[ btn-group ]"> <label for="fancy-checkbox-info-custom-icons" class="[ btn btn-info ]"> <span class="[ glyphicon glyphicon-plus ]"></span> <span class="[ glyphicon glyphicon-minus ]"></span> </label> <label for="fancy-checkbox-info-custom-icons" class="[ btn btn-default active ]"> Info Checkbox </label> </div> </div> <div class="[ form-group ]"> <input type="checkbox" name="fancy-checkbox-warning-custom-icons" id="fancy-checkbox-warning-custom-icons" autocomplete="off" /> <div class="[ btn-group ]"> <label for="fancy-checkbox-warning-custom-icons" class="[ btn btn-warning ]"> <span class="[ glyphicon glyphicon-plus ]"></span> <span class="[ glyphicon glyphicon-minus ]"></span> </label> <label for="fancy-checkbox-warning-custom-icons" class="[ btn btn-default active ]"> Warning Checkbox </label> </div> </div> <div class="[ form-group ]"> <input type="checkbox" name="fancy-checkbox-danger-custom-icons" id="fancy-checkbox-danger-custom-icons" autocomplete="off" /> <div class="[ btn-group ]"> <label for="fancy-checkbox-danger-custom-icons" class="[ btn btn-danger ]"> <span class="[ glyphicon glyphicon-plus ]"></span> <span class="[ glyphicon glyphicon-minus ]"></span> </label> <label for="fancy-checkbox-danger-custom-icons" class="[ btn btn-default active ]"> Danger Checkbox </label> </div> </div> </div> </div>
.form-group input[type="checkbox"] { display: none; } .form-group input[type="checkbox"] + .btn-group > label div { //width: 20px; } .form-group input[type="checkbox"] + .btn-group > label div:first-child { display: none; } .form-group input[type="checkbox"] + .btn-group > label div:last-child { display: inline-block; } .form-group input[type="checkbox"]:checked + .btn-group > label div:first-child { display: inline-block; } .form-group input[type="checkbox"]:checked + .btn-group > label div:last-child { display: none; } .rounded{ width:20px; height:20px; border-radius:50%; text-align:center; } .checked{ background:grey; color:white; } .unchecked{ border:1px solid grey; } .is-urgent, .urgent{ width:100px; height:30px; line-height:30px; text-align:center; background:white; border:1px solid grey; } .urgent{ background:red; color:white; }
$(function(){ $(":checkbox").change(function(){ var $collpase = $(this).closest(".panel").find(".collapse"); if(this.checked){ $collpase.collapse("show"); }else{ $collpase.collapse("hide"); } }) })

Related: See More


Questions / Comments: