|
@@ -2,16 +2,16 @@
|
|
|
<html lang="en">
|
|
|
<head>
|
|
|
<meta charset="utf-8">
|
|
|
- <title>Bootstrap Switch · Turn checkboxes and radio buttons in toggle switches.</title>
|
|
|
- <meta name="description" content="Turn checkboxes and radio buttons in toggle switches.">
|
|
|
- <meta name="author" content="Mattia Larentis">
|
|
|
- <meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
|
|
+ <meta http-equiv="X-UA-Compatible" content="IE=edge">
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
|
- <link rel="stylesheet" href="docs/vendor/bootstrap.min.css" />
|
|
|
- <!-- <link rel="stylesheet" href="http://netdna.bootstrapcdn.com/font-awesome/3.2.1/css/font-awesome.css"> -->
|
|
|
- <!-- <link rel="stylesheet" href="http://bdmdesign.github.io/bootstrap-switch/static/stylesheets/flat-ui-fonts.css"> -->
|
|
|
- <link rel="stylesheet" href="docs/vendor/prism.css">
|
|
|
- <link rel="stylesheet" href="build/css/bootstrap3/bootstrap-switch.min.css" />
|
|
|
+ <meta name="description" content="Turn checkboxes and radio buttons in toggle switches.">
|
|
|
+ <meta name="author" content="Mattia Larentis, Emanuele Marchi and Peter Stein">
|
|
|
+ <title>Bootstrap Switch · Turn checkboxes and radio buttons in toggle switches</title>
|
|
|
+ <link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.1.0/css/bootstrap.min.css">
|
|
|
+ <link rel="stylesheet" href="//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.min.css">
|
|
|
+ <link rel="stylesheet" href="http://bdmdesign.github.io/bootstrap-switch/static/stylesheets/flat-ui-fonts.css">
|
|
|
+ <link rel="stylesheet" href="build/css/bootstrap3/bootstrap-switch.css" />
|
|
|
+ <link rel="stylesheet" href="docs/lib/prism.css">
|
|
|
<link rel="stylesheet" href="docs/index.css">
|
|
|
<script>
|
|
|
var _gaq = _gaq || [];
|
|
@@ -30,10 +30,58 @@
|
|
|
<body>
|
|
|
<a href="https://github.com/nostalgiaz/bootstrap-switch" id="github"><img src="https://s3.amazonaws.com/github/ribbons/forkme_right_gray_6d6d6d.png" alt="Fork me on GitHub">
|
|
|
</a>
|
|
|
- <header class="header">
|
|
|
+ <header class="navbar navbar-default navbar-fixed-top header" role="banner">
|
|
|
+ <div class="container">
|
|
|
+ <div class="row">
|
|
|
+ <div class="col-sm-10 col-sm-offset-1">
|
|
|
+ <div class="navbar-header">
|
|
|
+ <button class="navbar-toggle" type="button" data-toggle="collapse" data-target="#collapse">
|
|
|
+ <span class="sr-only">Toggle navigation</span>
|
|
|
+ <span class="icon-bar"></span>
|
|
|
+ <span class="icon-bar"></span>
|
|
|
+ <span class="icon-bar"></span>
|
|
|
+ </button>
|
|
|
+ <a href="../" class="navbar-brand">Bootstrap Switch</a>
|
|
|
+ </div>
|
|
|
+ <nav id="collapse" class="collapse navbar-collapse" role="navigation">
|
|
|
+ <ul class="nav navbar-nav">
|
|
|
+ <li><a href="#getting-started">Getting started</a></li>
|
|
|
+ <li><a href="https://github.com/nostalgiaz/bootstrap-switch/archive/3.0.zip">Download 3rc</a></li>
|
|
|
+ <li class="dropdown">
|
|
|
+ <a href="#documentation" data-toggle="dropdown">Documentation <span class="caret"></span></a>
|
|
|
+ <ul class="dropdown-menu">
|
|
|
+ <li><a href="#sizes">Sizes</a></li>
|
|
|
+ <li><a href="#colors">Colors</a></li>
|
|
|
+ <li><a href="#animation">Animation</a></li>
|
|
|
+ <li><a href="#disabled">Disabled / Readonly</a></li>
|
|
|
+ <li><a href="#text">Text</a></li>
|
|
|
+ <li><a href="#label-text">Label Text</a></li>
|
|
|
+ <li><a href="#icon-label-text">Icon Label Text</a></li>
|
|
|
+ <li><a href="#event-handler">Event Handler</a></li>
|
|
|
+ <li><a href="#label-event-handler">Label Event Handler</a></li>
|
|
|
+ <li><a href="#state">State</a></li>
|
|
|
+ <li><a href="#destroy">Destroy</a></li>
|
|
|
+ <li><a href="#disable">Disable / Readonly</a></li>
|
|
|
+ <li><a href="#radio">Radio</a></li>
|
|
|
+ <li><a href="#form">Form</a></li>
|
|
|
+ <li><a href="#modal">Modal</a></li>
|
|
|
+ </ul>
|
|
|
+ </li>
|
|
|
+ <li><a href="https://github.com/nostalgiaz/bootstrap-switch/issues">Bug reports</a></li>
|
|
|
+ </ul>
|
|
|
+ </nav>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </header>
|
|
|
+ <main id="main" class="jumbotron" role="main">
|
|
|
<div class="container">
|
|
|
- <h1>Bootstrap Switch <span class="small">2.0.1</span></h1>
|
|
|
- <h2>Turn checkboxes and radio buttons in toggle switches.</h2>
|
|
|
+ <h1>Bootstrap Switch</h1>
|
|
|
+ <p class="lead">Turn checkboxes and radio buttons in toggle switches.</p>
|
|
|
+ <div>
|
|
|
+ <a href="https://github.com/nostalgiaz/bootstrap-switch/archive/3.0.zip" class="btn btn-lg btn-primary">Download Bootstrap Switch 3 Release Candidate</a><br>
|
|
|
+ <a href="https://github.com/nostalgiaz/bootstrap-switch/archive/master.zip" class="btn btn-link">Download Stable Bootstrap Switch 2</a>
|
|
|
+ </div>
|
|
|
<br>
|
|
|
<iframe src="http://ghbtns.com/github-btn.html?user=nostalgiaz&repo=bootstrap-switch&type=watch&count=true" allowtransparency="true" frameborder="0" scrolling="0" width="120" height="30"></iframe>
|
|
|
<iframe src="http://ghbtns.com/github-btn.html?user=nostalgiaz&repo=bootstrap-switch&type=fork&count=true" allowtransparency="true" frameborder="0" scrolling="0" width="110" height="30"></iframe>
|
|
@@ -45,20 +93,40 @@
|
|
|
<p class="people">
|
|
|
<a href="http://larentis.eu" target="_blank">Mattia Larentis</a> · <a href="http://www.bdmdesign.org/" target="_blank">Peter Stein</a> · <a href="http://www.lostcrew.it" target="_blank">Emanuele Marchi</a>
|
|
|
</p>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
- </header>
|
|
|
- <hr>
|
|
|
+ </main>
|
|
|
<div class="container">
|
|
|
- <div class="row">
|
|
|
- <div class="col-sm-10 col-sm-offset-1">
|
|
|
- <section name="size">
|
|
|
+ <div class="row">
|
|
|
+ <div class="col-sm-10 col-sm-offset-1">
|
|
|
+ <section id="getting-started" class="section">
|
|
|
<div class="page-header">
|
|
|
- <h2>Sizes</h2>
|
|
|
+ <h2><a href="#getting-started">Getting started</a></h2>
|
|
|
</div>
|
|
|
- <input type="checkbox" checked class="switch-large">
|
|
|
+ <p>Include the dependencies: jQuery, Bootstrap and Bootstrap Switch CSS + Javascript.</p>
|
|
|
+ <pre class="language-markup"><code>[...]
|
|
|
+<link href="bootstrap.css" rel="stylesheet">
|
|
|
+<link href="bootstrap-switch.css" rel="stylesheet">
|
|
|
+<script src="jquery.js"></script>
|
|
|
+<script src="bootstrap-switch.js"></script>
|
|
|
+[...]</code></pre>
|
|
|
+ <p>Add your checkbox.</p>
|
|
|
+ <pre class="language-markup"><code><input type="checkbox" name="my-checkbox" checked></code></pre>
|
|
|
+ <p>Initialize Bootstrap Switch.</p>
|
|
|
+ <pre class="language-javascript"><code>$("[name='my-checkbox']").bootstrapSwitch();</code></pre>
|
|
|
+ <p>Enjoy.</p>
|
|
|
+ </section>
|
|
|
+ <div class="page-header">
|
|
|
+ <h2><a href="#documentation">Documentation</a></h2>
|
|
|
+ </div>
|
|
|
+ <section id="sizes" class="section">
|
|
|
+ <div class="page-header">
|
|
|
+ <h3><a href="#sizes">Sizes</a></h3>
|
|
|
+ </div>
|
|
|
+ <input type="checkbox" checked data-size="large">
|
|
|
<input type="checkbox" checked>
|
|
|
- <input type="checkbox" checked class="switch-small">
|
|
|
- <input type="checkbox" checked class="switch-mini">
|
|
|
+ <input type="checkbox" checked data-size="small">
|
|
|
+ <input type="checkbox" checked data-size="mini">
|
|
|
<br>
|
|
|
<br>
|
|
|
<p>Change the size programmatically:</p>
|
|
@@ -70,133 +138,129 @@
|
|
|
<button id="btn-size-small-switch" class="btn btn-default">Small</button>
|
|
|
<button id="btn-size-mini-switch" class="btn btn-default">Mini</button>
|
|
|
<br>
|
|
|
- <pre class="language-markup"><code><input type="checkbox" checked class="switch-large">
|
|
|
+ <pre class="language-markup"><code><input type="checkbox" checked data-size="large">
|
|
|
<input type="checkbox" checked>
|
|
|
-<input type="checkbox" checked class="switch-small">
|
|
|
-<input type="checkbox" checked class="switch-mini">
|
|
|
+<input type="checkbox" checked data-size="small">
|
|
|
+<input type="checkbox" checked data-size="mini">
|
|
|
<input id="dimension-switch" type="checkbox" checked></code></pre>
|
|
|
<pre class="language-javascript"><code>// Resets to the regular style
|
|
|
-$('#dimension-switch').bootstrapSwitch('setSizeClass', '');
|
|
|
+$('#dimension-switch').bootstrapSwitch('size', '');
|
|
|
|
|
|
// Sets a mini switch
|
|
|
-$('#dimension-switch').bootstrapSwitch('setSizeClass', 'switch-mini');
|
|
|
+$('#dimension-switch').bootstrapSwitch('size', 'mini');
|
|
|
|
|
|
// Sets a small switch
|
|
|
-$('#dimension-switch').bootstrapSwitch('setSizeClass', 'switch-small');
|
|
|
+$('#dimension-switch').bootstrapSwitch('size', 'small');
|
|
|
|
|
|
// Sets a large switch
|
|
|
-$('#dimension-switch').bootstrapSwitch('setSizeClass', 'switch-large');</code></pre>
|
|
|
+$('#dimension-switch').bootstrapSwitch('size', 'large');</code></pre>
|
|
|
</section>
|
|
|
- <section name="colors">
|
|
|
+ <section id="colors" class="section">
|
|
|
<div class="page-header">
|
|
|
- <h2><a href="#colors">Colors</a></h2>
|
|
|
+ <h3><a href="#colors">Colors</a></h3>
|
|
|
</div>
|
|
|
- <input type="checkbox" checked data-on="primary" data-off="info">
|
|
|
- <input type="checkbox" checked data-on="info" data-off="success">
|
|
|
- <input type="checkbox" checked data-on="success" data-off="warning">
|
|
|
- <input type="checkbox" checked data-on="warning" data-off="danger">
|
|
|
- <input type="checkbox" checked data-on="danger" data-off="default">
|
|
|
- <input type="checkbox" checked data-on="default" data-off="primary">
|
|
|
+ <input type="checkbox" checked data-on-color="primary" data-off-color="info">
|
|
|
+ <input type="checkbox" checked data-on-color="info" data-off-color="success">
|
|
|
+ <input type="checkbox" checked data-on-color="success" data-off-color="warning">
|
|
|
+ <input type="checkbox" checked data-on-color="warning" data-off-color="danger">
|
|
|
+ <input type="checkbox" checked data-on-color="danger" data-off-color="default">
|
|
|
+ <input type="checkbox" checked data-on-color="default" data-off-color="primary">
|
|
|
<br>
|
|
|
<br>
|
|
|
<span>Change the colors programmatically:</span>
|
|
|
- <input type="checkbox" id="change-color-switch" checked data-on="default" data-off="primary">
|
|
|
+ <input type="checkbox" id="change-color-switch" checked data-on-color="default" data-off-color="primary">
|
|
|
<br>
|
|
|
<br>
|
|
|
<button id="btn-color-on-switch" class="btn btn-success">Change ON color</button>
|
|
|
<button id="btn-color-off-switch" class="btn btn-danger">Change OFF color</button>
|
|
|
- <pre class="language-markup"><code><input type="checkbox" checked data-on="primary" data-off="info">
|
|
|
-<input type="checkbox" checked data-on="info" data-off="success">
|
|
|
-<input type="checkbox" checked data-on="success" data-off="warning">
|
|
|
-<input type="checkbox" checked data-on="warning" data-off="danger">
|
|
|
-<input type="checkbox" checked data-on="danger" data-off="default">
|
|
|
-<input type="checkbox" checked data-on="default" data-off="primary">
|
|
|
-<input type="checkbox" id="change-color-switch" checked data-on="default" data-off="primary"></code></pre>
|
|
|
- <pre class="language-javascript"><code>$('#change-color-switch').bootstrapSwitch('setOnClass', 'success');
|
|
|
-$('#change-color-switch').bootstrapSwitch('setOffClass', 'danger');</code></pre>
|
|
|
+ <pre class="language-markup"><code><input type="checkbox" checked data-on-color="primary" data-off-color="info">
|
|
|
+<input type="checkbox" checked data-on-color="info" data-off-color="success">
|
|
|
+<input type="checkbox" checked data-on-color="success" data-off-color="warning">
|
|
|
+<input type="checkbox" checked data-on-color="warning" data-off-color="danger">
|
|
|
+<input type="checkbox" checked data-on-color="danger" data-off-color="default">
|
|
|
+<input type="checkbox" checked data-on-color="default" data-off-color="primary">
|
|
|
+<input type="checkbox" id="change-color-switch" checked data-on-color="default" data-off-color="primary"></code></pre>
|
|
|
+ <pre class="language-javascript"><code>$('#change-color-switch').bootstrapSwitch('onColor', 'success');
|
|
|
+$('#change-color-switch').bootstrapSwitch('offColor', 'danger');</code></pre>
|
|
|
</section>
|
|
|
- <section name="animation">
|
|
|
+ <section id="animation" class="section">
|
|
|
<div class="page-header">
|
|
|
- <h2><a name="animation" class="anchor" href="#animation">Animation <small>JavaScript</small></a></h2>
|
|
|
+ <h3><a name="animation" class="anchor" href="#animation">Animation <small>JavaScript</small></a></h3>
|
|
|
</div>
|
|
|
<input type="checkbox" id="animated-switch" checked data-animated="false">
|
|
|
<br>
|
|
|
<br>
|
|
|
<button id="btn-animate-switch" class="btn btn-default">Animate</button>
|
|
|
<button id="btn-dont-animate-switch" class="btn btn-default">Don't animate</button>
|
|
|
- <pre class="language-markup"><code><input type="checkbox" checked data-animated="false"></code></pre>
|
|
|
+ <pre class="language-markup"><code><input type="checkbox" checked data-animate="false"></code></pre>
|
|
|
<pre class="language-javascript"><code>// Enables animation for the selected item
|
|
|
-$('#animated-switch').bootstrapSwitch('setAnimated', true);
|
|
|
+$('#animated-switch').bootstrapSwitch('animate', true);
|
|
|
|
|
|
// Disables animation for the selected item
|
|
|
-$('#animated-switch').bootstrapSwitch('setAnimated', false);</code></pre>
|
|
|
+$('#animated-switch').bootstrapSwitch('animate', false);</code></pre>
|
|
|
</section>
|
|
|
- <section name="disabled">
|
|
|
+ <section id="disabled" class="section">
|
|
|
<div class="page-header">
|
|
|
- <h2><a name="disabled" class="anchor" href="#disabled">Disabled / Readonly</a></h2>
|
|
|
+ <h3><a name="disabled" class="anchor" href="#disabled">Disabled / Readonly</a></h3>
|
|
|
</div>
|
|
|
<input type="checkbox" checked disabled>
|
|
|
<input type="checkbox" checked readonly>
|
|
|
<pre class="language-markup"><code><input type="checkbox" checked disabled>
|
|
|
<input type="checkbox" checked readonly></code></pre>
|
|
|
</section>
|
|
|
- <section name="text">
|
|
|
+ <section id="text" class="section">
|
|
|
<div class="page-header">
|
|
|
- <h2><a name="text" class="anchor" href="#text">Text</a></h2>
|
|
|
+ <h3><a name="text" class="anchor" href="#text">Text</a></h3>
|
|
|
</div>
|
|
|
- <input type="checkbox" id="label-switch" checked data-on-label="SI" data-off-label="NO">
|
|
|
+ <input type="checkbox" id="label-switch" checked data-on-text="SI" data-off-text="NO">
|
|
|
<br>
|
|
|
<br>
|
|
|
<button id="btn-label-on-switch" class="btn btn-default">Change "On" label</button>
|
|
|
<button id="btn-label-off-switch" class="btn btn-default">Change "Off" label</button>
|
|
|
- <pre class="language-markup"><code><input type="checkbox" checked data-on-label="SI" data-off-label="NO"></code></pre>
|
|
|
- <pre class="language-javascript"><code>$('#label-switch').bootstrapSwitch('setOnLabel', 'I');
|
|
|
-$('#label-switch').bootstrapSwitch('setOffLabel', 'O');</code></pre>
|
|
|
+ <pre class="language-markup"><code><input type="checkbox" checked data-on-text="SI" data-off-text="NO"></code></pre>
|
|
|
+ <pre class="language-javascript"><code>$('#label-switch').bootstrapSwitch('onText', 'I');
|
|
|
+$('#label-switch').bootstrapSwitch('offText', 'O');</code></pre>
|
|
|
</section>
|
|
|
+ <section id="label-text" class="section">
|
|
|
<div class="page-header">
|
|
|
- <h2><a name="label-text" class="anchor" href="#label-text">Label Text</a></h2>
|
|
|
- </div>
|
|
|
- <div class="bs-docs-example">
|
|
|
- <input type="checkbox" checked data-text-label="TV">
|
|
|
- </div>
|
|
|
- <pre class="language-markup"><code><input type="checkbox" checked data-text-label="TV"></code></pre>
|
|
|
- <div class="page-header">
|
|
|
- <h2><a name="html-text" class="anchor" href="#html-text">HTML Text</a></h2>
|
|
|
- </div>
|
|
|
- <div class="bs-docs-example">
|
|
|
- <input type="checkbox" checked data-on-label="<i class='icon-ok icon-white'></i>" data-off-label="<i class='icon-remove'></i>">
|
|
|
+ <h3><a href="#label-text">Label Text</a></h3>
|
|
|
</div>
|
|
|
- <pre class="language-markup"><code><input type="checkbox" checked data-on-label="<i class='icon-ok icon-white'></i>" data-off-label="<i class='icon-remove'></i>"></code></pre>
|
|
|
+ <input type="checkbox" checked data-label-text="TV">
|
|
|
+ <pre class="language-markup"><code><input type="checkbox" checked data-label-text="TV"></code></pre>
|
|
|
+ </section>
|
|
|
+ <section id="icon-label-text" class="section">
|
|
|
<div class="page-header">
|
|
|
- <h2><a name="html-text-label-icon" class="anchor" href="#html-text-label-icon">HTML Text Label Icon</a></h2>
|
|
|
- </div>
|
|
|
- <div class="bs-docs-example">
|
|
|
- Standard <input type="checkbox" checked class="switch-large" data-label-icon="icon-fullscreen" data-on-label="<i class='icon-ok icon-white'></i>" data-off-label="<i class='icon-remove'></i>">
|
|
|
- Font Awesome <input type="checkbox" checked class="switch-large" data-label-icon="icon-youtube icon-large" data-on-label="<i class='icon-thumbs-up icon-white'></i>" data-off-label="<i class='icon-thumbs-down'></i>">
|
|
|
- Flat UI <input type="checkbox" class="switch-large" checked data-label-icon="fui-video" data-on-label="<i class='fui-check icon-white'></i>" data-off-label="<i class='fui-cross'></i>">
|
|
|
+ <h3><a name="icon-label-text" class="anchor" href="#html-text-label-icon">Icon Label Text</a></h3>
|
|
|
</div>
|
|
|
- <pre class="language-markup"><code><input type="checkbox" checked class="switch-large" data-label-icon="icon-fullscreen" data-on-label="<i class='icon-ok icon-white'></i>" data-off-label="<i class='icon-remove'></i>">
|
|
|
-<input type="checkbox" checked class="switch-large" data-label-icon="icon-youtube icon-large" data-on-label="<i class='icon-thumbs-up icon-white'></i>" data-off-label="<i class='icon-thumbs-down'></i>">
|
|
|
-<input type="checkbox" class="switch-large" checked data-label-icon="fui-video" data-on-label="<i class='fui-check icon-white'></i>" data-off-label="<i class='fui-cross'></i>"></code></pre>
|
|
|
+
|
|
|
+ Standard <input type="checkbox" checked data-size="large" data-label-text="<span class='glyphicon glyphicon-fullscreen'></span>" data-on-text="<span class='glyphicon glyphicon-ok'></span>" data-off-text="<span class='glyphicon glyphicon-remove'></span>">
|
|
|
+
|
|
|
+ Font Awesome <input type="checkbox" checked data-size="large" data-label-text="<span class='fa fa-youtube fa-lg'></span>" data-on-text="<span class='fa fa-thumbs-up fa-lg'></span>" data-off-text="<span class='fa fa-thumbs-down fa-lg'></span>">
|
|
|
+
|
|
|
+ Flat UI <input type="checkbox" data-size="large" checked data-label-text="<span class='fui-video'></span>" data-on-text="<span class='fui-check'></span>" data-off-text="<span class='fui-cross'></span>">
|
|
|
+
|
|
|
+ <pre class="language-markup"><code><input type="checkbox" checked data-size="large" data-label-text="<span class='glyphicon glyphicon-fullscreen'></span>" data-on-text="<span class='glyphicon glyphicon-ok'></span>" data-off-text="<span class='glyphicon glyphicon-remove'></span>">
|
|
|
+<input type="checkbox" checked data-size="large" data-label-text="<span class='fa fa-youtube fa-lg'></span>" data-on-text="<span class='fa fa-thumbs-up fa-lg'></span>" data-off-text="<span class='fa fa-thumbs-down fa-lg'></span>">
|
|
|
+<input type="checkbox" data-size="large" checked data-label-text="<span class='fui-video'></span>" data-on-text="<span class='fui-check'></span>" data-off-text="<span class='fui-cross'></span>"></code></pre>
|
|
|
+ </section>
|
|
|
+ <section id="event-handler" class="section">
|
|
|
<div class="page-header">
|
|
|
- <h2><a name="event-handler-javascript" class="anchor" href="#event-handler-javascript">Event Handler <small>JavaScript</small></a></h2>
|
|
|
- </div>
|
|
|
- <div class="bs-docs-example">
|
|
|
- <input type="checkbox" id="switch-change" checked>
|
|
|
+ <h3><a name="event-handler" class="anchor" href="#event-handler">Event Handler <small>JavaScript</small></a></h3>
|
|
|
</div>
|
|
|
- <pre class="language-javascript"><code>$('#switch-change').on('switch-change', function (e, data) {
|
|
|
+ <input type="checkbox" id="switch-change" checked>
|
|
|
+ <pre class="language-javascript"><code>$('#switch-change').on('switchChange', function (e, data) {
|
|
|
var $element = $(data.el),
|
|
|
value = data.value;
|
|
|
|
|
|
console.log(e, $element, value);
|
|
|
});</code></pre>
|
|
|
+ </section>
|
|
|
+ <section id="label-event-handler" class="section">
|
|
|
<div class="page-header">
|
|
|
- <h2><a name="label-event-handler-javascript" class="anchor" href="#label-event-handler-javascript">Label Event Handler <small>JavaScript</small></a></h2>
|
|
|
- </div>
|
|
|
- <div class="bs-docs-example">
|
|
|
- <label id="label-toggle-switch">Click on this Text to change the switch state</label>
|
|
|
- <input type="checkbox" checked class="label-toggle-switch">
|
|
|
+ <h3><a name="label-event-handler" class="anchor" href="#label-event-handler">Label Event Handler <small>JavaScript</small></a></h3>
|
|
|
</div>
|
|
|
+ <label id="label-toggle-switch">Click on this Text to change the switch state</label>
|
|
|
+ <input type="checkbox" checked class="label-toggle-switch">
|
|
|
<pre class="language-markup"><code><label id="label-toggle-switch">Click on this Text to change the switch state</label>
|
|
|
<input type="checkbox" checked></code></pre>
|
|
|
<pre class="language-javascript"><code>$('#label-toggle-switch').on('click', function(e, data) {
|
|
@@ -205,83 +269,73 @@ $('#label-switch').bootstrapSwitch('setOffLabel', 'O');</code></pre>
|
|
|
$('.label-toggle-switch').on('switch-change', function (e, data) {
|
|
|
alert(data.value);
|
|
|
});</code></pre>
|
|
|
+ </section>
|
|
|
+ <section id="state" class="section">
|
|
|
<div class="page-header">
|
|
|
- <h2><a name="toggle-state" class="anchor" href="#toggle-state">Toggle State <small>JavaScript</small></a></h2>
|
|
|
- </div>
|
|
|
- <div class="bs-docs-example">
|
|
|
- <input type="checkbox" id="toggle-state-switch" checked>
|
|
|
- <br>
|
|
|
- <br>
|
|
|
- <div id="toggle-state-switch-button-state" class="btn btn-default">State!</div>
|
|
|
- <div id="toggle-state-switch-button-on" class="btn btn-default">On</div>
|
|
|
- <div id="toggle-state-switch-button" class="btn btn-default">Toggle</div>
|
|
|
- <div id="toggle-state-switch-button-off" class="btn btn-default">Off</div>
|
|
|
+ <h3><a name="state" class="anchor" href="#state">State <small>JavaScript</small></a></h3>
|
|
|
</div>
|
|
|
+ <input type="checkbox" id="toggle-state-switch" checked>
|
|
|
+ <br>
|
|
|
+ <br>
|
|
|
+ <div id="toggle-state-switch-button-state" class="btn btn-default">State!</div>
|
|
|
+ <div id="toggle-state-switch-button-on" class="btn btn-default">On</div>
|
|
|
+ <div id="toggle-state-switch-button" class="btn btn-default">Toggle</div>
|
|
|
+ <div id="toggle-state-switch-button-off" class="btn btn-default">Off</div>
|
|
|
<pre class="language-javascript"><code>$('#toggle-state-switch').bootstrapSwitch('state'); // true || false
|
|
|
$('#toggle-state-switch').bootstrapSwitch('toggleState');
|
|
|
-$('#toggle-state-switch').bootstrapSwitch('setState', false); // true || false</code></pre>
|
|
|
+$('#toggle-state-switch').bootstrapSwitch('state', false); // true || false</code></pre>
|
|
|
+ </section>
|
|
|
+ <section id="destroy" class="section">
|
|
|
<div class="page-header">
|
|
|
- <h2><a name="destroy" class="anchor" href="#destroy">Destroy <small>JavaScript</small></a></h2>
|
|
|
- </div>
|
|
|
- <div class="bs-docs-example">
|
|
|
- <input type="checkbox" id="destroy-switch" checked >
|
|
|
- <br>
|
|
|
- <br>
|
|
|
- <button id="btn-destroy-switch" class="btn btn-default">Destroy me!</button>
|
|
|
+ <h3><a name="destroy" class="anchor" href="#destroy">Destroy <small>JavaScript</small></a></h3>
|
|
|
</div>
|
|
|
+ <input type="checkbox" id="destroy-switch" checked>
|
|
|
+ <br>
|
|
|
+ <br>
|
|
|
+ <button id="btn-destroy-switch" class="btn btn-default">Destroy me!</button>
|
|
|
<pre class="language-javascript"><code>$('#destroy-switch').bootstrapSwitch('destroy');</code></pre>
|
|
|
+ </section>
|
|
|
+ <section id="disable" class="section">
|
|
|
<div class="page-header">
|
|
|
- <h2><a name="create" class="anchor" href="#create">Create <small>JavaScript</small></a></h2>
|
|
|
- </div>
|
|
|
- <div class="bs-docs-example">
|
|
|
- <input id="create-switch" type="checkbox" checked>
|
|
|
- <br>
|
|
|
- <br>
|
|
|
- <div id="btn-create" class="btn btn-default">Create</div>
|
|
|
- </div>
|
|
|
- <pre class="language-javascript"><code>$('#create-switch').bootstrapSwitch();</code></pre>
|
|
|
- <div class="page-header">
|
|
|
- <h2><a name="disabled-javascript" class="anchor" href="#disabled-javascript">Disable / Readonly <small>JavaScript</small></a></h2>
|
|
|
+ <h3><a name="disable" class="anchor" href="#disable">Disable / Readonly <small>JavaScript</small></a></h3>
|
|
|
</div>
|
|
|
- <div class="bs-docs-example">
|
|
|
- <label for="disable-switch">Disable controls</label>
|
|
|
- <input type="checkbox" id="disable-switch" checked>
|
|
|
- <br>
|
|
|
- <br>
|
|
|
- <button id="btn-disable-is" class="btn btn-default">Is disabled?</button>
|
|
|
- <button id="btn-disable-toggle" class="btn btn-default">Toggle Disable</button>
|
|
|
- <button id="btn-disable-set" class="btn btn-default">Set Disable</button>
|
|
|
- <button id="btn-disable-remove" class="btn btn-default">Remove Disable</button>
|
|
|
- <br>
|
|
|
- <br>
|
|
|
- <label for="readonly-switch">Readonly controls</label>
|
|
|
- <input type="checkbox" id="readonly-switch" checked>
|
|
|
- <br>
|
|
|
- <br>
|
|
|
- <button id="btn-readonly-is" class="btn btn-default">Is readonly?</button>
|
|
|
- <button id="btn-readonly-toggle" class="btn btn-default">Toggle readonly</button>
|
|
|
- <button id="btn-readonly-set" class="btn btn-default">Set readonly</button>
|
|
|
- <button id="btn-readonly-remove" class="btn btn-default">Remove readonly</button>
|
|
|
- </div>
|
|
|
- <pre class="language-javascript"><code>$('#disable-switch').bootstrapSwitch('isDisabled');
|
|
|
+ <label for="disable-switch">Disable controls</label>
|
|
|
+ <input type="checkbox" id="disable-switch" checked>
|
|
|
+ <br>
|
|
|
+ <br>
|
|
|
+ <button id="btn-disable-is" class="btn btn-default">Is disabled?</button>
|
|
|
+ <button id="btn-disable-toggle" class="btn btn-default">Toggle Disable</button>
|
|
|
+ <button id="btn-disable-set" class="btn btn-default">Set Disable</button>
|
|
|
+ <button id="btn-disable-remove" class="btn btn-default">Remove Disable</button>
|
|
|
+ <br>
|
|
|
+ <br>
|
|
|
+ <label for="readonly-switch">Readonly controls</label>
|
|
|
+ <input type="checkbox" id="readonly-switch" checked>
|
|
|
+ <br>
|
|
|
+ <br>
|
|
|
+ <button id="btn-readonly-is" class="btn btn-default">Is readonly?</button>
|
|
|
+ <button id="btn-readonly-toggle" class="btn btn-default">Toggle readonly</button>
|
|
|
+ <button id="btn-readonly-set" class="btn btn-default">Set readonly</button>
|
|
|
+ <button id="btn-readonly-remove" class="btn btn-default">Remove readonly</button>
|
|
|
+ <pre class="language-javascript"><code>$('#disable-switch').bootstrapSwitch('disabled');
|
|
|
$('#disable-switch').bootstrapSwitch('toggleDisabled');
|
|
|
-$('#disable-switch').bootstrapSwitch('setDisabled', true); // true || false
|
|
|
+$('#disable-switch').bootstrapSwitch('disabled', true); // true || false
|
|
|
|
|
|
-$('#readonly-switch').bootstrapSwitch('isReadOnly');
|
|
|
-$('#readonly-switch').bootstrapSwitch('toggleReadOnly');
|
|
|
-$('#readonly-switch').bootstrapSwitch('setReadOnly', true); // true || false</code></pre>
|
|
|
+$('#readonly-switch').bootstrapSwitch('readonly');
|
|
|
+$('#readonly-switch').bootstrapSwitch('toggleReadonly');
|
|
|
+$('#readonly-switch').bootstrapSwitch('readonly', true); // true || false</code></pre>
|
|
|
+ </section>
|
|
|
+ <section id="radio" class="section">
|
|
|
<div class="page-header">
|
|
|
- <h2><a name="radio-javascript" class="anchor" href="#radio-javascript">Radio <small>JavaScript</small></a></h2>
|
|
|
+ <h3><a name="radio" class="anchor" href="#radio">Radio <small>JavaScript</small></a></h3>
|
|
|
</div>
|
|
|
- <div class="bs-docs-example">
|
|
|
- <div class="form-group">
|
|
|
- <label for="option1">Option 1</label>
|
|
|
- <input id="option1" type="radio" name="radio1" value="option1" class="radio1 radio-no-uncheck">
|
|
|
- <label for="option2">Option 2</label>
|
|
|
- <input id="option2" type="radio" name="radio1" value="option2" class="radio1 radio-no-uncheck">
|
|
|
- <label for="option3">Option 3</label>
|
|
|
- <input id="option3" type="radio" name="radio1" value="option3" class="radio1 radio-no-uncheck">
|
|
|
- </div>
|
|
|
+ <div class="form-group">
|
|
|
+ <label for="option1">Option 1</label>
|
|
|
+ <input id="option1" type="radio" name="radio1" value="option1">
|
|
|
+ <label for="option2">Option 2</label>
|
|
|
+ <input id="option2" type="radio" name="radio1" value="option2">
|
|
|
+ <label for="option3">Option 3</label>
|
|
|
+ <input id="option3" type="radio" name="radio1" value="option3">
|
|
|
</div>
|
|
|
<pre class="language-markup"><code><div class="form-group">
|
|
|
<label for="option1">Option 1</label>
|
|
@@ -291,66 +345,28 @@ $('#readonly-switch').bootstrapSwitch('setReadOnly', true); // true || false</c
|
|
|
<label for="option3">Option 3</label>
|
|
|
<input id="option3" type="radio" name="radio1" value="option3">
|
|
|
</div></code></pre>
|
|
|
- <pre class="language-javascript"><code>$('.radio1').on('switch-change', function () {
|
|
|
- $('.radio1').bootstrapSwitch('toggleRadioState');
|
|
|
-});
|
|
|
-
|
|
|
-// or
|
|
|
-$('.radio1').on('switch-change', function () {
|
|
|
- $('.radio1').bootstrapSwitch('toggleRadioStateAllowUncheck');
|
|
|
-});
|
|
|
-
|
|
|
-// or
|
|
|
-$('.radio1').on('switch-change', function () {
|
|
|
- $('.radio1').bootstrapSwitch('toggleRadioStateAllowUncheck', false);
|
|
|
-});</code></pre>
|
|
|
+ </section>
|
|
|
+ <section id="form" class="section">
|
|
|
<div class="page-header">
|
|
|
- <h2><a name="radio-javascript-allow-uncheck" class="anchor" href="#radio-javascript-allow-uncheck">Radio + uncheck <small>JavaScript</small></a></h2>
|
|
|
+ <h3><a name="form" class="anchor" href="#form">Form</a></h3>
|
|
|
</div>
|
|
|
- <div class="bs-docs-example">
|
|
|
+ <form class="clearfix" role="form">
|
|
|
<div class="form-group">
|
|
|
- <label for="option11">Option 1</label>
|
|
|
- <input id="option11" type="radio" name="radio2" value="option11" class="radio2">
|
|
|
- <label for="option12">Option 2</label>
|
|
|
- <input id="option12" type="radio" name="radio2" value="option12" checked="checked" class="radio2">
|
|
|
- <label for="option13">Option 3</label>
|
|
|
- <input id="option13" type="radio" name="radio2" value="option13" class="radio2">
|
|
|
+ <label class="control-label" for="inputEmail">Email</label>
|
|
|
+ <input type="text" id="inputEmail" placeholder="Email" class="form-control">
|
|
|
</div>
|
|
|
- </div>
|
|
|
- <pre class="language-markup"><code><div class="form-group">
|
|
|
- <label for="option11">Option 1</label>
|
|
|
- <input id="option11" type="radio" name="radio2" value="option1">
|
|
|
- <label for="option12">Option 2</label>
|
|
|
- <input id="option12" type="radio" name="radio2" value="option2" checked="checked">
|
|
|
- <label for="option13">Option 3</label>
|
|
|
- <input id="option13" type="radio" name="radio2" value="option3">
|
|
|
-</div></code></pre>
|
|
|
- <pre class="language-javascript"><code>$('.radio2').on('switch-change', function () {
|
|
|
- $('.radio2').bootstrapSwitch('toggleRadioStateAllowUncheck', true);
|
|
|
-});</code></pre>
|
|
|
- <div class="page-header">
|
|
|
- <h2><a name="form" class="anchor" href="#form">Form</a></h2>
|
|
|
- </div>
|
|
|
- <div class="bs-docs-example">
|
|
|
- <form class="clearfix" role="form">
|
|
|
- <div class="form-group">
|
|
|
- <label class="control-label" for="inputEmail">Email</label>
|
|
|
- <input type="text" id="inputEmail" placeholder="Email" class="form-control">
|
|
|
- </div>
|
|
|
- <div class="form-group">
|
|
|
- <label class="control-label" for="notification1">Notification 1</label>
|
|
|
- <input id="notification1" type="checkbox">
|
|
|
- </div>
|
|
|
- <div class="form-group">
|
|
|
- <label class="control-label" for="notification2">Notification 2</label>
|
|
|
- <input id="notification2" type="checkbox">
|
|
|
- </div>
|
|
|
- <div class="form-actions">
|
|
|
- <button type="reset" class="btn btn-default btn-warning">Reset</button>
|
|
|
- </div>
|
|
|
- </form>
|
|
|
- <div ></div>
|
|
|
- </div>
|
|
|
+ <div class="form-group">
|
|
|
+ <label class="control-label" for="notification1">Notification 1</label>
|
|
|
+ <input id="notification1" type="checkbox">
|
|
|
+ </div>
|
|
|
+ <div class="form-group">
|
|
|
+ <label class="control-label" for="notification2">Notification 2</label>
|
|
|
+ <input id="notification2" type="checkbox">
|
|
|
+ </div>
|
|
|
+ <div class="form-actions">
|
|
|
+ <button type="reset" class="btn btn-default btn-warning">Reset</button>
|
|
|
+ </div>
|
|
|
+ </form>
|
|
|
<pre class="language-markup"><code><form class="form-horizontal">
|
|
|
<div class="form-group">
|
|
|
<label class="control-label" for="inputEmail">Email</label>
|
|
@@ -368,17 +384,18 @@ $('.radio1').on('switch-change', function () {
|
|
|
<button type="reset" class="btn btn-inverse">Reset</button>
|
|
|
</div>
|
|
|
</form></code></pre>
|
|
|
- <div class="page-header">
|
|
|
- <h2><a name="modal" class="anchor" href="#modal">Modal</a></h2>
|
|
|
- </div>
|
|
|
- <div class="bs-docs-example">
|
|
|
+ </section>
|
|
|
+ <section id="modal" class="section">
|
|
|
+ <div class="page-header">
|
|
|
+ <h3><a name="modal" class="anchor" href="#modal">Modal</a></h3>
|
|
|
+ </div>
|
|
|
<a href="#myModal" role="button" class="btn btn-default" data-toggle="modal">Modal</a>
|
|
|
- </div>
|
|
|
- <pre class="language-markup"><code><a href="#myModal" role="button" class="btn btn-default" data-toggle="modal">Modal</a>
|
|
|
+ <pre class="language-markup"><code><a href="#myModal" role="button" class="btn btn-default" data-toggle="modal">Modal</a>
|
|
|
|
|
|
<div class="modal-body">
|
|
|
<input type="checkbox" checked>
|
|
|
</div></code></pre>
|
|
|
+ </section>
|
|
|
<footer class="footer">
|
|
|
<p>© by <a href="http://larentis.eu" target="_blank">Mattia Larentis</a> (<a href="https://twitter.com/SpiritualGuru">@SpiritualGuru</a>), <a href="http://www.bdmdesign.org/" target="_blank">Peter Stein</a> and <a href="http://www.lostcrew.it/" target="_blank">Emanuele Marchi</a></p>
|
|
|
</footer>
|
|
@@ -401,10 +418,10 @@ $('.radio1').on('switch-change', function () {
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
- <script src="docs/vendor/jquery.js"></script>
|
|
|
- <script src="docs/vendor/bootstrap.min.js"></script>
|
|
|
- <script src="build/js/bootstrap-switch.min.js"></script>
|
|
|
- <script src="docs/vendor/prism.js"></script>
|
|
|
+ <script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>
|
|
|
+ <script src="//netdna.bootstrapcdn.com/bootstrap/3.1.0/js/bootstrap.min.js"></script>
|
|
|
+ <script src="build/js/bootstrap-switch.js"></script>
|
|
|
+ <script src="docs/lib/prism.js"></script>
|
|
|
<script src="docs/index.js"></script>
|
|
|
</body>
|
|
|
</html>
|