The template includes a complete set of switches sizes, all focusable and controlable by keyboard. Using switches is quite easy: add the class switch to a radio or an input, it will be styled automatically:
<input type="checkbox" class="switch">
Note that all additional classes will also be added to the switch element (margins, colors...)
If you prefer the switches to work as on iOS, add the class reversed-switches to any of its ancestors:
<p class="reversed-switches"> <input type="checkbox" class="switch"> </p>
If you want to reverse all switches, just add the class to the body element.
The switches can be easily customized:
// Using separate attributes <input type="checkbox" class="switch" checked data-text-on="YES" data-text-off="NO"> // Using option attribute <input type="checkbox" class="switch" checked data-checkable-options='{"textOn":"YES","textOff":"NO"}'>
// Use any class from the colors sets <input type="checkbox" class="switch red-active"> <input type="checkbox" class="switch blue-active">
// Wide switch <input type="checkbox" class="switch wide"> // Wider switch <input type="checkbox" class="switch wider">
// Medium switches, different sizes <input type="checkbox" class="switch medium"> <input type="checkbox" class="switch medium wide"> <input type="checkbox" class="switch medium wider">
// Tiny switch <input type="checkbox" class="switch tiny"> // Switch mini <input type="checkbox" class="switch mini">
As any input, switches may be disabled: disabled the original radio/checkbox or add the class disabled.
// Really disabled <input type="checkbox" class="switch" disabled> // Looking like it is disabled <input type="checkbox" class="switch disabled">
Note that if you need to disable/enabled switches at runtime, you must use the template methods:
// Enable switch $(selector).enableInput(); // Disable switch $(selector).disableInput();