111 lines
5.2 KiB
HTML
111 lines
5.2 KiB
HTML
|
<!DOCTYPE html>
|
||
|
<html lang="en">
|
||
|
<head>
|
||
|
<meta charset="utf-8">
|
||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||
|
<meta name="description" content="Turn checkboxes and radio buttons into toggle switches.">
|
||
|
<meta name="author" content="Mattia Larentis, Emanuele Marchi and Peter Stein">
|
||
|
<title>Bootstrap Switch · Turn checkboxes and radio buttons into toggle switches</title>
|
||
|
<link href="docs/css/bootstrap.min.css" rel="stylesheet">
|
||
|
<link href="docs/css/highlight.css" rel="stylesheet">
|
||
|
<link href="dist/css/bootstrap3/bootstrap-switch.css" rel="stylesheet">
|
||
|
<link href="http://getbootstrap.com/assets/css/docs.min.css" rel="stylesheet">
|
||
|
<link href="docs/css/main.css" rel="stylesheet">
|
||
|
<script>
|
||
|
var _gaq = _gaq || [];
|
||
|
_gaq.push(['_setAccount', 'UA-43092768-1']);
|
||
|
_gaq.push(['_trackPageview']);
|
||
|
(function () {
|
||
|
var ga = document.createElement('script');
|
||
|
ga.type = 'text/javascript';
|
||
|
ga.async = true;
|
||
|
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
|
||
|
var s = document.getElementsByTagName('script')[0];
|
||
|
s.parentNode.insertBefore(ga, s);
|
||
|
})();
|
||
|
</script>
|
||
|
</head>
|
||
|
<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 role="banner" class="navbar navbar-static-top bs-docs-nav">
|
||
|
<div class="container">
|
||
|
<div class="navbar-header">
|
||
|
<button type="button" data-toggle="collapse" data-target="#collapse" class="navbar-toggle"><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" role="navigation" class="collapse navbar-collapse bs-navbar-collapse">
|
||
|
<ul class="nav navbar-nav">
|
||
|
<li><a href="https://github.com/nostalgiaz/bootstrap-switch/archive/master.zip" data-toggle="dropdown">Download</a></li>
|
||
|
<li><a href="examples.html">Examples</a></li>
|
||
|
<li class="dropdown"><a href="#" data-toggle="dropdown">Documentation <span class="caret"></span></a>
|
||
|
<ul class="dropdown-menu">
|
||
|
<li><a href="/options.html">Options</a></li>
|
||
|
<li><a href="/methods.html">Methods</a></li>
|
||
|
<li><a href="/events.html">Events</a></li>
|
||
|
<li role="presentation" class="divider"></li>
|
||
|
<li><a href="/documentation-2.html">Documentation (v2.0.1)</a></li>
|
||
|
</ul>
|
||
|
</li>
|
||
|
<li><a href="https://github.com/nostalgiaz/bootstrap-switch/issues">Bug reports</a></li>
|
||
|
</ul>
|
||
|
</nav>
|
||
|
</div>
|
||
|
</header>
|
||
|
<main id="content" role="main">
|
||
|
<div id="content" class="bs-docs-header">
|
||
|
<div class="container">
|
||
|
<h1>Events</h1>
|
||
|
</div>
|
||
|
</div>
|
||
|
<div class="container">
|
||
|
<p>
|
||
|
All the events are namespaced, therefore always append <code>.bootstrapSwitch</code> when you
|
||
|
attach your handlers.<br>
|
||
|
You can register to the emitted events as follows:
|
||
|
</p>
|
||
|
<pre><code>$('input[name="my-checkbox"]').on('switchChange.bootstrapSwitch', function(event, state) {
|
||
|
console.log(this); // DOM element
|
||
|
console.log(event); // jQuery event
|
||
|
console.log(state); // true | false
|
||
|
});</code></pre>
|
||
|
<table class="table table-bordered table-striped table-responsive">
|
||
|
<thead>
|
||
|
<tr>
|
||
|
<th>Name</th>
|
||
|
<th>Description</th>
|
||
|
<th>Parameters</th>
|
||
|
</tr>
|
||
|
</thead>
|
||
|
<tbody>
|
||
|
<tr>
|
||
|
<td>init</td>
|
||
|
<td>Triggered on initialization. 'this' refers to the DOM element.</td>
|
||
|
<td>
|
||
|
event (<a href="https://api.jquery.com/category/events/event-object/" target="_blank">jQuery Event object</a>)
|
||
|
state (true | false)
|
||
|
</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td>switchChange</td>
|
||
|
<td>Triggered on switch state change. 'this' refers to the DOM element.</td>
|
||
|
<td>
|
||
|
event (<a href="https://api.jquery.com/category/events/event-object/" target="_blank">jQuery Event object</a>),
|
||
|
state (true | false)
|
||
|
</td>
|
||
|
</tr>
|
||
|
</tbody>
|
||
|
</table>
|
||
|
</div>
|
||
|
</main>
|
||
|
<footer class="bs-docs-footer">
|
||
|
<div class="container">
|
||
|
<p>Code licensed under <a href="http://www.apache.org/licenses/LICENSE-2.0" target="_blank">Apache License, Version 2.0</a><br>Created by <a href="https://github.com/nostalgiaz" target="_blank">Mattia Larentis</a><br>Mantained by <a href="https://github.com/lostcrew" target="_blank">Emanuele Marchi</a>
|
||
|
</p>
|
||
|
</div>
|
||
|
</footer>
|
||
|
<script src="docs/js/jquery.min.js"></script>
|
||
|
<script src="docs/js/bootstrap.min.js"></script>
|
||
|
<script src="docs/js/highlight.js"></script>
|
||
|
<script src="dist/js/bootstrap-switch.js"></script>
|
||
|
<script src="docs/js/main.js"></script>
|
||
|
</body>
|
||
|
</html>
|