All Projects → LCweb-ita → LC-switch

LCweb-ita / LC-switch

Licence: MIT license
Superlight vanilla javascript plugin improving forms look and functionality

Programming Languages

javascript
184084 projects - #8 most used programming language
HTML
75241 projects

Projects that are alternatives of or similar to LC-switch

Form Js
Easily create web forms. Supports Meteor, AngularJS, React, Polymer and any CSS library, e.g. Bootstrap.
Stars: ✭ 9 (-70.97%)
Mutual labels:  forms, checkbox, radio-buttons
Xamarincontrols
Cross-platform controls for Xamarin and Xamarin.Forms.
Stars: ✭ 104 (+235.48%)
Mutual labels:  forms, checkbox
Checkbox.css
☑️ Tiny set of pure CSS animations for your checkbox input. https://720kb.github.io/checkbox.css/
Stars: ✭ 478 (+1441.94%)
Mutual labels:  forms, checkbox
Autocomplete.js
Simple autocomplete pure vanilla Javascript library.
Stars: ✭ 3,428 (+10958.06%)
Mutual labels:  lightweight, vanilla-javascript
sweetconfirm.js
👌A useful zero-dependencies, less than 434 Bytes (gzipped), pure JavaScript & CSS solution for drop an annoying pop-ups confirming the submission of form in your web apps.
Stars: ✭ 34 (+9.68%)
Mutual labels:  forms, pure-javascript
boxdetect
BoxDetect is a Python package based on OpenCV which allows you to easily detect rectangular shapes like character or checkbox boxes on scanned forms.
Stars: ✭ 46 (+48.39%)
Mutual labels:  forms, checkbox
zoom
Lightweight (8 Kb) ES5 javascript plugin without any dependencies, compatible with desktop and mobile devices.
Stars: ✭ 25 (-19.35%)
Mutual labels:  lightweight, vanilla-javascript
Selectionlist
Simple single-selection or multiple-selection checklist, based on UITableView
Stars: ✭ 93 (+200%)
Mutual labels:  checkbox, radio-buttons
Beedle
A tiny library inspired by Redux & Vuex to help you manage state in your JavaScript apps
Stars: ✭ 329 (+961.29%)
Mutual labels:  lightweight, vanilla-javascript
Splide
Splide is a lightweight, powerful and flexible slider and carousel, written in pure JavaScript without any dependencies.
Stars: ✭ 786 (+2435.48%)
Mutual labels:  lightweight, vanilla-javascript
Uploader
A lightweight and very configurable jQuery plugin for file uploading using ajax(a sync); includes support for queues, progress tracking and drag and drop.
Stars: ✭ 1,042 (+3261.29%)
Mutual labels:  lightweight, forms
Pretty Checkbox Vue
Quickly integrate pretty checkbox components with Vue.js
Stars: ✭ 240 (+674.19%)
Mutual labels:  checkbox, radio-buttons
React Menu
React component for building accessible menu, dropdown, submenu, context menu and more.
Stars: ✭ 237 (+664.52%)
Mutual labels:  checkbox, radio-buttons
Pretty Checkbox
A pure CSS library to beautify checkbox and radio buttons.
Stars: ✭ 1,708 (+5409.68%)
Mutual labels:  checkbox, radio-buttons
jpopup
Simple lightweight (<2kB) javascript popup modal plugin
Stars: ✭ 27 (-12.9%)
Mutual labels:  lightweight, vanilla-javascript
Radio Group
845 byte WAI-ARIA 1.1 compliant radio group React component
Stars: ✭ 133 (+329.03%)
Mutual labels:  forms, radio-buttons
Magic Input
CSS3 Styles for Checkbox and Radio Button inputs look prettier. with only one element.
Stars: ✭ 81 (+161.29%)
Mutual labels:  checkbox, radio-buttons
Multipicker
Form styling plugin for jQuery
Stars: ✭ 90 (+190.32%)
Mutual labels:  checkbox, radio-buttons
Darkmode Js
DarkModeJS helps you to auto detect user's time and switch theme to darkside
Stars: ✭ 328 (+958.06%)
Mutual labels:  lightweight, vanilla-javascript
Examples wxWidgets
Shows how to use wxWidgets controls only by programming code (c++17).
Stars: ✭ 116 (+274.19%)
Mutual labels:  checkbox, radio-buttons

Superlight pure javascript form switch plugin by LCweb

Give a modern look to your applications and take advantage of javascript events and public functions.
Vanilla javascript. No dependencies. Everything in a single 7KB file, all inclusive!


Top features list:

  • sigle 7KB file, no dependencies, 100% ES6 javascript
  • minimal integration efforts in existing forms
  • public functions to manage each field status
  • hook through textual selector or DOM object (yes also jQuery ones)
  • complete events tracking
  • custom texts support
  • optional compact mode
  • optional custom active color (supporting gradients)

Tested on all mordern browsers (don't ask for old IE support please)
For live demos check: https://lcweb.it/lc-switch-javascript-plugin


Installation & Usage

  1. include lc_switch.min.js

  2. initialize plugin targeting one/multiple fields.
    NB: first parameter may be a textual selector or a DOM object (yes, also jQuery objects)

<script type="text/javascript">
lc_switch('input[type=checkbox], input[type=radio]');
</script>

Options

Available options with default values

<script type="text/javascript>
lc_switch('input[type=checkbox], input[type=radio]', {

    // (string) "checked" status label text
    on_txt      : 'ON',
    
    // (string) "not checked" status label text
    off_txt     : 'OFF',

    // (string) custom "on" color. Supports also gradients
    on_color    : false,

    // (bool) whether to enable compact mode
    compact_mode: false
});
</script>

Public Functions

Available public functions to be called on initialized inputs

<script type="text/javascript">
const inputs = document.querySelectorAll('input[type=checkbox], input[type=radio]');
lc_switch(inputs):


// checks the field
lcs_on(inputs);

// unchecks the field
lcs_off(inputs);

// toggles targeted field
lcs_toggle(inputs);


// disables the field
lcs_disable(inputs);

// enables the field
lcs_enable(inputs);


// refreshes plugin interface retrieving input attributes (useful while changing HTML attributes directly)
lcs_update(inputs);

// destroys plugin initialization showing HTML fields again
lcs_destroy(inputs);
</script>

Public Events

<script type="text/javascript">
document.querySelectorAll('input[type=checkbox], input[type=radio]').forEach(function(el) {

    // triggered each time input status changes (checked and disabled)
    el.addEventListener('lcs-statuschange', ...);
    
    
    // triggered each time input is checked
    el.addEventListener('lcs-on', ...);
    
    // triggered each time input is uncheked
    el.addEventListener('lcs-off', ...);
    
    
    // triggered each time input is enabled
    el.addEventListener('lcs-enabled', ...);
    
    // triggered each time input is disabled
    el.addEventListener('lcs-disabled', ...);

});
</script>

Copyright © Luca Montanari - LCweb

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].