Superlight Vanilla Javascript Plugin For Sliding Toggle Switches | LC-switch

Superlight Pure javascript form switch form plugin by LCweb, gives a fresh look to your applications, leveraging javascript events and general functions.

LC Switch is a small jQuery and Vanilla JS plugin that converts default checkbox and radio inputs into pretty switches or toggle buttons, with smooth sliding effects supported by CSS3 transitions.

List of most important features:

  • Single 7 KB file, no dependencies, ES6 100% JavaScript
  • Minimal integration efforts in the present forms
  • General functions to manage the case of each domain
  • Linking via a selector or DOM object (yes also jQuery objects)
  • Complete event tracking
  • Support custom texts
  • Optional compact mode
  • Optional custom active color (gradients support)

How to make use of it:

1. Import the jQuery library and the jQuery LC Switch plugin’s information into your undertaking.

<script src="jquery.min.js"></script>
<script src="lc_switch.js"></script>
<link rel="stylesheet" href="lc_switch.css" />

2. Call the plugin on the checkbox & radio inputs and achieved. The plugin will deal with the remaining.

$('input').lc_switch();

3. Public capabilities.

// toggle on
$('input').lcs_on();

// toggle off
$('input').lcs_off();

// destroy
$('input').lcs_destroy();

4. Events.

// triggered each time a field changes status
$('body').delegate('.lcs_check', 'lcs-statuschange', function() {
  var status = ($(this).is(':checked')) ? 'checked' : 'unchecked';
  console.log('field changed status: '+ status );
});

// triggered each time a field is checked
$('body').delegate('.lcs_check', 'lcs-on', function() {
  console.log('field is checked');
});

// triggered each time a is unchecked
$('body').delegate('.lcs_check', 'lcs-off', function() {
  console.log('field is unchecked');
});

JavaScript Plugin For Sliding Toggle Switches, LCweb Plugin/Github, toggle switch js, jquery toggle switch, switcher on off jquery


See Demo And Download

Official Website(LCweb-ita): Click Here

This superior jQuery/javascript plugin is developed by LCweb-ita. For extra Advanced Usage, please go to the official website.

Share