All Projects → weatherstar → Switch

weatherstar / Switch

Licence: mit
🐰 A simple and powerful switch for checkbox.

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Switch

simple-switch
Vanilla JS/CSS Switch UI element
Stars: ✭ 18 (-96.34%)
Mutual labels:  checkbox, switch
Vxe Table
🐬 vxe-table vue 表格解决方案
Stars: ✭ 4,242 (+762.2%)
Mutual labels:  switch, checkbox
Bootstrap Switch
Turn checkboxes and radio buttons in toggle switches.
Stars: ✭ 5,132 (+943.09%)
Mutual labels:  switch, checkbox
Jhform
JhForm - 自定义表单工具,更加简单,快捷的创建表单、设置页面
Stars: ✭ 108 (-78.05%)
Mutual labels:  switch, checkbox
Flutter smart select
SmartSelect allows you to easily convert your usual form select or dropdown into dynamic page, popup dialog, or sliding bottom sheet with various choices input such as radio, checkbox, switch, chips, or even custom input. Supports single and multiple choice.
Stars: ✭ 179 (-63.62%)
Mutual labels:  switch, checkbox
React Icheck
🔘 iCheck components built with React. Highly customizable checkbox, radio buttons and radio group.
Stars: ✭ 175 (-64.43%)
Mutual labels:  switch, checkbox
Aiflatswitch
Nicely animated flat design switch alternative to UISwitch
Stars: ✭ 904 (+83.74%)
Mutual labels:  switch, checkbox
GDCheckbox
Customizable CheckBox / RadioButton component for iOS
Stars: ✭ 23 (-95.33%)
Mutual labels:  checkbox, switch
Easy Toggle State
A tiny JavaScript library to easily toggle the state of any HTML element in any contexts, and create UI components in no time.
Stars: ✭ 261 (-46.95%)
Mutual labels:  switch, checkbox
Lagopus
Yet another SDN / OpenFlow software switch
Stars: ✭ 281 (-42.89%)
Mutual labels:  switch
Androlua pro
Lua5.3.3 for android pro
Stars: ✭ 350 (-28.86%)
Mutual labels:  switch
Aio Switch Updater
All-in-One Nintendo Switch Updater
Stars: ✭ 272 (-44.72%)
Mutual labels:  switch
Nbaseuikit
个人平时使用的一些Qt编写的组件(有部分是整合的开源作品,部分是自己原创);
Stars: ✭ 286 (-41.87%)
Mutual labels:  switch
Reactnative Animation Challenges
A series of animation challenges in React Native.
Stars: ✭ 352 (-28.46%)
Mutual labels:  switch
Kmansonoff
Firmware for ESP8266 based itead Sonoff switches for use with HomeAssistant / mqtt
Stars: ✭ 282 (-42.68%)
Mutual labels:  switch
Rekado
Payload launcher and serial number checker for Nintendo Switch
Stars: ✭ 455 (-7.52%)
Mutual labels:  switch
Laravel Recaptcha
Google ReCaptcha package for Laravel
Stars: ✭ 273 (-44.51%)
Mutual labels:  checkbox
Switchthemeinjector
Create custom themes for the nintendo switch !
Stars: ✭ 436 (-11.38%)
Mutual labels:  switch
Switch Desktop
⚡️ Keyboard-driven commands to navigate your apps faster
Stars: ✭ 320 (-34.96%)
Mutual labels:  switch
Edizon cheatsconfigsandscripts
The official EdiZon Editor Config and Editor Script repository.
Stars: ✭ 271 (-44.92%)
Mutual labels:  switch

Switch

Build Status Coverage Status

🐰 A simple and powerful iOS style switch for checkbox.

Live Preview

Installation

Standalone:
<link rel="stylesheet" href="dist/switch.css" />
<script src="dist/switch.js"></script>
npm:
$ npm install weatherstar-switch --save-dev

Usage

<input type="checkbox" class="checkbox-switch" />

standalone version

var el = document.querySelector('.checkbox-switch');
var mySwitch = new Switch(el, options);

work with module bundle

require('weatherstar-switch/dist/switch.css');
var Switch = require('weatherstar-switch');

var el = document.querySelector('.checkbox-switch');
var mySwitch = new Switch(el, options);

Settings and Defaults

defaults = {
    size             : 'default'
  , checked          : undefined
  , onText           : 'Y'
  , offText          : 'N'
  , onSwitchColor    : '#64BD63'
  , offSwitchColor   : '#fff'
  , onJackColor      : '#fff'
  , offJackColor     : '#fff'
  , showText         : false
  , disabled         : false
  , onInit           : function(){}
  , beforeChange     : function(){}
  , onChange         : function(){}
  , beforeRemove     : function(){}
  , onRemove         : function(){}
  , beforeDestroy    : function(){}
  , onDestroy        : function(){}
};
  • size : size of switch element, can be default | small | large
  • checked : state of switch and checbox, if undefined the switch state according to the checkbox
  • onText : text in the jack when switch ON
  • offText : text in the jack when switch OFF
  • onSwitchColor : color of checked switch element
  • offSwitchColor : color of unchecked switch element
  • onJackColor : color of checked jack element
  • offJackColor : color of unchecked jack element
  • showText : show or hide text in the jack of switch
  • disabled : enable or disable click events and changing the state of the switch
  • onInit : called when switch init finish
  • beforeChange : called before original checkbox's checked change
  • onChange : called when original checkbox's checked change
  • beforeRemove : called before remove switch element from DOM
  • onRemove : called when remove switch element from DOM done
  • beforeDestroy : called before remove all events on switch element
  • onDestroy : called when remove all events on switch element done

Predefined Classes

switch-danger switch-primary switch-black switch-success switch-warning switch-info switch-transparent

API

.getChecked()

Get switch element checked status.

.on()

Set switch ON.

.off()

Set switch OFF.

.toggle()

Toggle switch.

.disable()

Disable events bind to switch.

.enable()

Enable events bind to switch.

.destroy()

Remove all events bind to switch.

.remove()

Remove switch form DOM and show the checkbox.

License

MIT © zhiyul

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].