A custom checkbox HTML, CSS, jquery, and iPhone style button to activate or deactivate the checkbox. We keep an input check box so we can submit it via forms. The custom checkbox is a very small jQuery snippet that turns checkboxes into iOS-style toggle buttons while preserving the original selection functions and deselecting the functions.
toggle switch onoff jquery, jquery ui toggle switch onoff, jquery toggle button onoff, switchery checkbox uncheck jquery, switch button jquery ui, toggle button plugin
How to make use of it:
1. Add the next HTML next to the checkbox input.
<input type="checkbox" name="switch" /> <div class="customcheck"> <div class="checkitem"></div> </div>
2. Hide the original checkbox.
input[name="switch"]{ display:none; }
3. Customize the looks of the swap control.
.customcheck { width: 80px; height: 20px; border: 3px solid #BDBDBD; border-radius: 20px; background: #d8d8d8; }
4. Customize the looks of the thumb.
/* styles when inactive */ .checkitem { width: 14px; height: 14px; border-radius: 16px; border: 2px solid #484848; background-color: #696969; margin: 1px; margin-left: 2px; transition: all 0.5s ease; } /* styles when active */ .itemactive{ margin-left: 60px; border: 2px solid #0ebd0e; background-color: #24da24; }
4. Include the newest jQuery library.
<script src="/path/to/cdn/jquery.slim.min.js"></script>
5. The jQuery script to activate the swap control.
$(".checkitem").click(function(){ var item = $(".checkitem"); if (item.hasClass("itemactive")){ // It is activated. Deactivate it! item.removeClass("itemactive"); $(".customcheck").css("background-color", "#d8d8d8") $("input[name='switch']").prop("checked", false); } else { // It's deactivated. Activate it! item.addClass("itemactive"); $(".customcheck").css("background-color", "#befbbe") $("input[name='switch']").prop("checked", true); } });
Convert Checkbox Into iOS-style Switch, customcheckbox Plugin/Github, jquery switch button
See Demo And Download
Official Website(crisego): Click Here
This superior jQuery/javascript plugin is developed by crisego. For extra Advanced Usages, please go to the official website.