Skip to content
This repository has been archived by the owner on Jan 15, 2022. It is now read-only.

novus/OnOff-Toggle

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 

Repository files navigation

An "on/off" replacement toggle for html checkboxes, modeled after a familiar UI.

There are other implementations available, but we prefer a lighter version without the need for images or (much) javascript.

Using the jQuery plugin, it's easy to replace checkboxes with on/off toggles:

$("form").onOff();

The state of the peer control will be kept in sync, so form submissions will behave exactly as the would have. You can also bind the click event of the peer to the toggle:

$("form").onOff({ bindClick: true });

This will preserve clickability on label elements bound to the checkbox control.

It is sometimes desirable to attach the same click behavior to both the peer control and the synthetic toggle:

$("#some_checkbox").onfOff("click", function(e, ckbox, onoff) {
  console.log(ckbox.checked);
});

About

On/Off html toggle control

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published