Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
unofficial bootstrap toggle buttons
JavaScript Ruby
branch: feature/new-an…

This branch is 56 commits behind nostalgiaz:master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
examples
static
.gitignore
LICENSE
README.md

README.md

bootstrap-toggle-buttons

live demo: http://www.larentis.eu/bootstrap_toggle_buttons/

Basic Usage

HTML

<div id="toggle-button">
    <input id="checkbox1" type="checkbox" value="value1" checked="checked">
</div>

JS

$('#toggle-button').toggleButtons();

Full Example

HTML

<div id="toggle-button">
    <input id="checkbox1" type="checkbox" value="value1" checked="checked">
</div>

JS

$('#toggle-button').toggleButtons({
  onChange: function ($el, status, e) {
    // $el = $('#toggle-button'); 
    // status = [true, false], the value of the checkbox
    // e = the event
    console.log($el, status, e); 
  },
  width: 100,
  animated: true,
  transitionSpeed: 1, // Accepted values float or "percent" [ 1, 0.5, "150%" ]
  label: {
    enabled: "ON",
    disabled: "OFF"
  },
  style: {
    // Accepted values ["primary", "danger", "info", "success", "warning"] or nothing
    enabled: "primary",
    disabled: "danger"
  }
});

$('#toggle-button').toggleButtons('toggleActivation'); // to toggle the disabled status
Something went wrong with that request. Please try again.