Custom Checkbox Into iOS-style Switch | customcheckbox

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.

Related Posts

drag-drop-file-5x5-jq-uploader

Responsive Drag and Drop File Uploader/Download Plugin | 5x5_jq_uploader

5x5_jq_uploader plugin can be used to instantly create a drop file area and file queue with a little bit of preparation. Bootstrap is used for responsive planning…

Bootstrap-Dark-Mode

Stylesheet For Implementing Dark Mode with Bootstrap

Bootstrap Dark Mode provides a style sheet and two texts that allow you to implement Dark Mode on your website. Initially loaded based on user preferences, can…

responsive-navigation-menu

Multi-purpose Navigation Menu for Javascript Library | jQuery Corenav

coreNavigation is a multipurpose navigation menu for a jquery based javascript library, comes with more style, and is easy to integrate. 11 Default Menu 2 Responsive Navigation…

Simple-Multi-Select-Dropdown-Pure-Vanilla-Javascript

Simple Multi-Select Dropdown Pure Vanilla Javascript | multiSelect.js

MultiSelect.js is a simple, clean, and progressive JavaScript library designed for easy integration with any type of project or system. The design was heavily influenced by the…

Confetti-Falling-Animation-Effect-party

Confetti Falling Animation Effect In JavaScript | party.js

Party.js is a JavaScript library to brighten user site experience with visual effects! Celebrate success with dom confetti! The library is written in TypeScript and compiled into…

how-to-create-popup-in-html-with-css

How To Create A Popup in HTML with CSS

How to create popup in html with css – Popup without JavaScript is an elegant pop-up panel component with an animated scale, written in CSS. Have you…