3.0.0 -> 3.0.1
[bootswatch] / bower_components / bootstrap / javascript.html
1 ---
2 layout: default
3 title: JavaScript
4 slug: js
5 lead: "Bring Bootstrap's components to life with over a dozen custom jQuery plugins. Easily include them all, or one by one."
6 base_url: "../"
7 ---
8
9
10   <!-- Overview
11   ================================================== -->
12   <div class="bs-docs-section">
13     <div class="page-header">
14       <h1 id="js-overview">Overview</h1>
15     </div>
16
17     <h3 id="js-individual-compiled">Individual or compiled</h3>
18     <p>Plugins can be included individually (using Bootstrap's individual <code>*.js</code> files), or all at once (using <code>bootstrap.js</code> or the minified <code>bootstrap.min.js</code>).</p>
19
20     <div class="bs-callout bs-callout-danger">
21       <h4>Do not attempt to include both.</h4>
22       <p>Both <code>bootstrap.js</code> and <code>bootstrap.min.js</code> contain all plugins in a single file.</p>
23     </div>
24
25     <div class="bs-callout bs-callout-danger">
26       <h4>Plugin dependencies</h4>
27       <p>Some plugins and CSS components depend on other plugins. If you include plugins individually, make sure to check for these dependencies in the docs. Also note that all plugins depend on jQuery (this means jQuery must be included <strong>before</strong> the plugin files). <a href="{{ site.repo }}/blob/v{{ site.current_version }}/bower.json">Consult our <code>bower.json</code></a> to see which versions of jQuery are supported.</p>
28     </div>
29
30     <h3 id="js-data-attrs">Data attributes</h3>
31     <p>You can use all Bootstrap plugins purely through the markup API without writing a single line of JavaScript. This is Bootstrap's first-class API and should be your first consideration when using a plugin.</p>
32
33     <p>That said, in some situations it may be desirable to turn this functionality off. Therefore, we also provide the ability to disable the data attribute API by unbinding all events on the document namespaced with <code>data-api</code>. This looks like this:
34 {% highlight js %}
35 $(document).off('.data-api')
36 {% endhighlight %}
37
38     <p>Alternatively, to target a specific plugin, just include the plugin's name as a namespace along with the data-api namespace like this:</p>
39 {% highlight js %}
40 $(document).off('.alert.data-api')
41 {% endhighlight %}
42
43     <h3 id="js-programmatic-api">Programmatic API</h3>
44     <p>We also believe you should be able to use all Bootstrap plugins purely through the JavaScript API. All public APIs are single, chainable methods, and return the collection acted upon.</p>
45 {% highlight js %}
46 $(".btn.danger").button("toggle").addClass("fat")
47 {% endhighlight %}
48
49     <p>All methods should accept an optional options object, a string which targets a particular method, or nothing (which initiates a plugin with default behavior):</p>
50 {% highlight js %}
51 $("#myModal").modal()                      // initialized with defaults
52 $("#myModal").modal({ keyboard: false })   // initialized with no keyboard
53 $("#myModal").modal('show')                // initializes and invokes show immediately</p>
54 {% endhighlight %}
55
56     <p>Each plugin also exposes its raw constructor on a <code>Constructor</code> property: <code>$.fn.popover.Constructor</code>. If you'd like to get a particular plugin instance, retrieve it directly from an element: <code>$('[rel=popover]').data('popover')</code>.</p>
57
58     <h3 id="js-noconflict">No conflict</h3>
59     <p>Sometimes it is necessary to use Bootstrap plugins with other UI frameworks. In these circumstances, namespace collisions can occasionally occur. If this happens, you may call <code>.noConflict</code> on the plugin you wish to revert the value of.</p>
60 {% highlight js %}
61 var bootstrapButton = $.fn.button.noConflict() // return $.fn.button to previously assigned value
62 $.fn.bootstrapBtn = bootstrapButton            // give $().bootstrapBtn the Bootstrap functionality
63 {% endhighlight %}
64
65     <h3 id="js-events">Events</h3>
66     <p>Bootstrap provides custom events for most plugin's unique actions. Generally, these come in an infinitive and past participle form - where the infinitive (ex. <code>show</code>) is triggered at the start of an event, and its past participle form (ex. <code>shown</code>) is trigger on the completion of an action.</p>
67     <p>As of 3.0.0, all Bootstrap events are namespaced.</p>
68     <p>All infinitive events provide <code>preventDefault</code> functionality. This provides the ability to stop the execution of an action before it starts.</p>
69 {% highlight js %}
70 $('#myModal').on('show.bs.modal', function (e) {
71   if (!data) return e.preventDefault() // stops modal from being shown
72 })
73 {% endhighlight %}
74
75     <div class="bs-callout bs-callout-warning" id="callout-third-party-libs">
76       <h4>Third-party libraries</h4>
77       <p><strong>Bootstrap does not officially support third-party JavaScript libraries</strong> like Prototype or jQuery UI. Despite <code>.noConflict</code> and namespaced events, there may be compatibility problems that you need to fix on your own. Ask on the <a href="http://groups.google.com/group/twitter-bootstrap">mailing list</a> if you need help.</p>
78     </div>
79   </div>
80
81
82
83   <!-- Transitions
84   ================================================== -->
85   <div class="bs-docs-section">
86     <div class="page-header">
87       <h1 id="transitions">Transitions <small>transition.js</small></h1>
88     </div>
89     <h3>About transitions</h3>
90     <p>For simple transition effects, include <code>transition.js</code> once alongside the other JS files. If you're using the compiled (or minified) <code>bootstrap.js</code>, there is no need to include this&mdash;it's already there.</p>
91     <h3>What's inside</h3>
92     <p>Transition.js is a basic helper for <code>transitionEnd</code> events as well as a CSS transition emulator. It's used by the other plugins to check for CSS transition support and to catch hanging transitions.</p>
93   </div>
94
95
96
97   <!-- Modal
98   ================================================== -->
99   <div class="bs-docs-section">
100     <div class="page-header">
101       <h1 id="modals">Modals <small>modal.js</small></h1>
102     </div>
103
104     <h2 id="modals-examples">Examples</h2>
105     <p>Modals are streamlined, but flexible, dialog prompts with the minimum required functionality and smart defaults.</p>
106
107     <div class="bs-callout bs-callout-warning" id="callout-stacked-modals">
108       <h4>Overlapping modals not supported</h4>
109       <p>Be sure not to open a modal while another is still visible. Showing more than one modal at a time requires custom code.</p>
110     </div>
111     <div class="bs-callout bs-callout-warning">
112       <h4>Mobile device caveats</h4>
113       <p>There are some caveats regarding using modals on mobile devices. <a href="{{ page.base_url }}getting-started#mobile-modals">See our browser support docs</a> for details.</p>
114     </div>
115
116     <h3>Static example</h3>
117     <p>A rendered modal with header, body, and set of actions in the footer.</p>
118     <div class="bs-example bs-example-modal">
119       <div class="modal">
120         <div class="modal-dialog">
121           <div class="modal-content">
122             <div class="modal-header">
123               <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
124               <h4 class="modal-title">Modal title</h4>
125             </div>
126             <div class="modal-body">
127               <p>One fine body&hellip;</p>
128             </div>
129             <div class="modal-footer">
130               <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
131               <button type="button" class="btn btn-primary">Save changes</button>
132             </div>
133           </div><!-- /.modal-content -->
134         </div><!-- /.modal-dialog -->
135       </div><!-- /.modal -->
136     </div><!-- /example -->
137 {% highlight html %}
138 <div class="modal fade">
139   <div class="modal-dialog">
140     <div class="modal-content">
141       <div class="modal-header">
142         <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
143         <h4 class="modal-title">Modal title</h4>
144       </div>
145       <div class="modal-body">
146         <p>One fine body&hellip;</p>
147       </div>
148       <div class="modal-footer">
149         <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
150         <button type="button" class="btn btn-primary">Save changes</button>
151       </div>
152     </div><!-- /.modal-content -->
153   </div><!-- /.modal-dialog -->
154 </div><!-- /.modal -->
155 {% endhighlight %}
156
157     <h3>Live demo</h3>
158     <p>Toggle a modal via JavaScript by clicking the button below. It will slide down and fade in from the top of the page.</p>
159     <!-- sample modal content -->
160     <div id="myModal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
161       <div class="modal-dialog">
162         <div class="modal-content">
163
164           <div class="modal-header">
165             <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
166             <h4 class="modal-title" id="myModalLabel">Modal Heading</h4>
167           </div>
168           <div class="modal-body">
169             <h4>Text in a modal</h4>
170             <p>Duis mollis, est non commodo luctus, nisi erat porttitor ligula.</p>
171
172             <h4>Popover in a modal</h4>
173             <p>This <a href="#" role="button" class="btn btn-default popover-test" title="A Title" data-content="And here's some amazing content. It's very engaging. right?">button</a> should trigger a popover on click.</p>
174
175             <h4>Tooltips in a modal</h4>
176             <p><a href="#" class="tooltip-test" title="Tooltip">This link</a> and <a href="#" class="tooltip-test" title="Tooltip">that link</a> should have tooltips on hover.</p>
177
178             <hr>
179
180             <h4>Overflowing text to show scroll behavior</h4>
181             <p>Cras mattis consectetur purus sit amet fermentum. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Morbi leo risus, porta ac consectetur ac, vestibulum at eros.</p>
182             <p>Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor auctor.</p>
183             <p>Aenean lacinia bibendum nulla sed consectetur. Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Donec sed odio dui. Donec ullamcorper nulla non metus auctor fringilla.</p>
184             <p>Cras mattis consectetur purus sit amet fermentum. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Morbi leo risus, porta ac consectetur ac, vestibulum at eros.</p>
185             <p>Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor auctor.</p>
186             <p>Aenean lacinia bibendum nulla sed consectetur. Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Donec sed odio dui. Donec ullamcorper nulla non metus auctor fringilla.</p>
187             <p>Cras mattis consectetur purus sit amet fermentum. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Morbi leo risus, porta ac consectetur ac, vestibulum at eros.</p>
188             <p>Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor auctor.</p>
189             <p>Aenean lacinia bibendum nulla sed consectetur. Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Donec sed odio dui. Donec ullamcorper nulla non metus auctor fringilla.</p>
190           </div>
191           <div class="modal-footer">
192             <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
193             <button type="button" class="btn btn-primary">Save changes</button>
194           </div>
195
196         </div><!-- /.modal-content -->
197       </div><!-- /.modal-dialog -->
198     </div><!-- /.modal -->
199
200     <div class="bs-example" style="padding-bottom: 24px;">
201       <button class="btn btn-primary btn-lg" data-toggle="modal" data-target="#myModal">
202         Launch demo modal
203       </button>
204     </div><!-- /example -->
205 {% highlight html %}
206 <!-- Button trigger modal -->
207 <button class="btn btn-primary btn-lg" data-toggle="modal" data-target="#myModal">
208   Launch demo modal
209 </button>
210
211 <!-- Modal -->
212 <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
213   <div class="modal-dialog">
214     <div class="modal-content">
215       <div class="modal-header">
216         <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
217         <h4 class="modal-title" id="myModalLabel">Modal title</h4>
218       </div>
219       <div class="modal-body">
220         ...
221       </div>
222       <div class="modal-footer">
223         <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
224         <button type="button" class="btn btn-primary">Save changes</button>
225       </div>
226     </div><!-- /.modal-content -->
227   </div><!-- /.modal-dialog -->
228 </div><!-- /.modal -->
229 {% endhighlight %}
230
231
232     <div class="bs-callout bs-callout-warning">
233       <h4>Make modals accessible</h4>
234       <p>Be sure to add <code>role="dialog"</code> to <code>.modal</code>, <code>aria-labelledby="myModalLabel"</code> attribute to reference the modal title, and <code>aria-hidden="true"</code> to tell assistive technologies to skip the modal's DOM elements.</p>
235       <p>Additionally, you may give a description of your modal dialog with <code>aria-describedby</code> on <code>.modal</code>.</p>
236     </div>
237
238     <h2 id="modals-usage">Usage</h2>
239     <p>The modal plugin toggles your hidden content on demand, via data attributes or JavaScript. It also adds <code>.model-open</code> to the <code>&lt;body&gt;</code> to override default scrolling behavior and generates a <code>.modal-backdrop</code> to provide a click area for dismissing shown modals when clicking outside the modal.</p>
240
241     <h3>Via data attributes</h3>
242     <p>Activate a modal without writing JavaScript. Set <code>data-toggle="modal"</code> on a controller element, like a button, along with a <code>data-target="#foo"</code> or <code>href="#foo"</code> to target a specific modal to toggle.</p>
243 {% highlight html %}
244 <button type="button" data-toggle="modal" data-target="#myModal">Launch modal</button>
245 {% endhighlight %}
246
247     <h3>Via JavaScript</h3>
248     <p>Call a modal with id <code>myModal</code> with a single line of JavaScript:</p>
249     {% highlight js %}$('#myModal').modal(options){% endhighlight %}
250
251     <h3>Options</h3>
252     <p>Options can be passed via data attributes or JavaScript. For data attributes, append the option name to <code>data-</code>, as in <code>data-backdrop=""</code>.</p>
253     <div class="table-responsive">
254       <table class="table table-bordered table-striped">
255         <thead>
256          <tr>
257            <th style="width: 100px;">Name</th>
258            <th style="width: 50px;">type</th>
259            <th style="width: 50px;">default</th>
260            <th>description</th>
261          </tr>
262         </thead>
263         <tbody>
264          <tr>
265            <td>backdrop</td>
266            <td>boolean or the string <code>'static'</code></td>
267            <td>true</td>
268            <td>Includes a modal-backdrop element. Alternatively, specify <code>static</code> for a backdrop which doesn't close the modal on click.</td>
269          </tr>
270          <tr>
271            <td>keyboard</td>
272            <td>boolean</td>
273            <td>true</td>
274            <td>Closes the modal when escape key is pressed</td>
275          </tr>
276          <tr>
277            <td>show</td>
278            <td>boolean</td>
279            <td>true</td>
280            <td>Shows the modal when initialized.</td>
281          </tr>
282          <tr>
283            <td>remote</td>
284            <td>path</td>
285            <td>false</td>
286            <td><p>If a remote URL is provided, content will be loaded via jQuery's <code>load</code> method and injected into the root of the modal element. If you're using the data-api, you may alternatively use the <code>href</code> attribute to specify the remote source. An example of this is shown below:</p>
287 {% highlight html %}
288 <a data-toggle="modal" href="remote.html" data-target="#modal">Click me</a>
289 {% endhighlight %}
290            </td>
291          </tr>
292         </tbody>
293       </table>
294     </div><!-- /.table-responsive -->
295
296     <h3>Methods</h3>
297
298     <h4>.modal(options)</h4>
299     <p>Activates your content as a modal. Accepts an optional options <code>object</code>.</p>
300 {% highlight js %}
301 $('#myModal').modal({
302   keyboard: false
303 })
304 {% endhighlight %}
305
306     <h4>.modal('toggle')</h4>
307     <p>Manually toggles a modal.</p>
308     {% highlight js %}$('#myModal').modal('toggle'){% endhighlight %}
309
310     <h4>.modal('show')</h4>
311     <p>Manually opens a modal.</p>
312     {% highlight js %}$('#myModal').modal('show'){% endhighlight %}
313
314     <h4>.modal('hide')</h4>
315     <p>Manually hides a modal.</p>
316     {% highlight js %}$('#myModal').modal('hide'){% endhighlight %}
317
318     <h3>Events</h3>
319     <p>Bootstrap's modal class exposes a few events for hooking into modal functionality.</p>
320     <div class="table-responsive">
321       <table class="table table-bordered table-striped">
322         <thead>
323          <tr>
324            <th style="width: 150px;">Event Type</th>
325            <th>Description</th>
326          </tr>
327         </thead>
328         <tbody>
329          <tr>
330            <td>show.bs.modal</td>
331            <td>This event fires immediately when the <code>show</code> instance method is called.</td>
332          </tr>
333          <tr>
334            <td>shown.bs.modal</td>
335            <td>This event is fired when the modal has been made visible to the user (will wait for CSS transitions to complete).</td>
336          </tr>
337          <tr>
338            <td>hide.bs.modal</td>
339            <td>This event is fired immediately when the <code>hide</code> instance method has been called.</td>
340          </tr>
341          <tr>
342            <td>hidden.bs.modal</td>
343            <td>This event is fired when the modal has finished being hidden from the user (will wait for CSS transitions to complete).</td>
344          </tr>
345         </tbody>
346       </table>
347     </div><!-- /.table-responsive -->
348 {% highlight js %}
349 $('#myModal').on('hidden.bs.modal', function () {
350   // do something…
351 })
352 {% endhighlight %}
353   </div>
354
355
356
357   <!-- Dropdowns
358   ================================================== -->
359   <div class="bs-docs-section">
360     <div class="page-header">
361       <h1 id="dropdowns">Dropdowns <small>dropdown.js</small></h1>
362     </div>
363
364     <h2 id="dropdowns-examples">Examples</h2>
365     <p>Add dropdown menus to nearly anything with this simple plugin, including the navbar, tabs, and pills.</p>
366
367     <h3>Within a navbar</h3>
368     <div class="bs-example">
369       <nav id="navbar-example" class="navbar navbar-default navbar-static" role="navigation">
370         <div class="navbar-header">
371           <button class="navbar-toggle" type="button" data-toggle="collapse" data-target=".bs-js-navbar-collapse">
372             <span class="sr-only">Toggle navigation</span>
373             <span class="icon-bar"></span>
374             <span class="icon-bar"></span>
375             <span class="icon-bar"></span>
376           </button>
377           <a class="navbar-brand" href="#">Project Name</a>
378         </div>
379         <div class="collapse navbar-collapse bs-js-navbar-collapse">
380           <ul class="nav navbar-nav">
381             <li class="dropdown">
382               <a id="drop1" href="#" role="button" class="dropdown-toggle" data-toggle="dropdown">Dropdown <b class="caret"></b></a>
383               <ul class="dropdown-menu" role="menu" aria-labelledby="drop1">
384                 <li role="presentation"><a role="menuitem" tabindex="-1" href="http://twitter.com/fat">Action</a></li>
385                 <li role="presentation"><a role="menuitem" tabindex="-1" href="http://twitter.com/fat">Another action</a></li>
386                 <li role="presentation"><a role="menuitem" tabindex="-1" href="http://twitter.com/fat">Something else here</a></li>
387                 <li role="presentation" class="divider"></li>
388                 <li role="presentation"><a role="menuitem" tabindex="-1" href="http://twitter.com/fat">Separated link</a></li>
389               </ul>
390             </li>
391             <li class="dropdown">
392               <a href="#" id="drop2" role="button" class="dropdown-toggle" data-toggle="dropdown">Dropdown 2 <b class="caret"></b></a>
393               <ul class="dropdown-menu" role="menu" aria-labelledby="drop2">
394                 <li role="presentation"><a role="menuitem" tabindex="-1" href="http://twitter.com/fat">Action</a></li>
395                 <li role="presentation"><a role="menuitem" tabindex="-1" href="http://twitter.com/fat">Another action</a></li>
396                 <li role="presentation"><a role="menuitem" tabindex="-1" href="http://twitter.com/fat">Something else here</a></li>
397                 <li role="presentation" class="divider"></li>
398                 <li role="presentation"><a role="menuitem" tabindex="-1" href="http://twitter.com/fat">Separated link</a></li>
399               </ul>
400             </li>
401           </ul>
402           <ul class="nav navbar-nav navbar-right">
403             <li id="fat-menu" class="dropdown">
404               <a href="#" id="drop3" role="button" class="dropdown-toggle" data-toggle="dropdown">Dropdown 3 <b class="caret"></b></a>
405               <ul class="dropdown-menu" role="menu" aria-labelledby="drop3">
406                 <li role="presentation"><a role="menuitem" tabindex="-1" href="http://twitter.com/fat">Action</a></li>
407                 <li role="presentation"><a role="menuitem" tabindex="-1" href="http://twitter.com/fat">Another action</a></li>
408                 <li role="presentation"><a role="menuitem" tabindex="-1" href="http://twitter.com/fat">Something else here</a></li>
409                 <li role="presentation" class="divider"></li>
410                 <li role="presentation"><a role="menuitem" tabindex="-1" href="http://twitter.com/fat">Separated link</a></li>
411               </ul>
412             </li>
413           </ul>
414         </div><!-- /.nav-collapse -->
415       </nav> <!-- /navbar-example -->
416     </div> <!-- /example -->
417
418     <h3>Within tabs</h3>
419     <div class="bs-example">
420       <ul class="nav nav-pills">
421         <li class="active"><a href="#">Regular link</a></li>
422         <li class="dropdown">
423           <a id="drop4" role="button" data-toggle="dropdown" href="#">Dropdown <b class="caret"></b></a>
424           <ul id="menu1" class="dropdown-menu" role="menu" aria-labelledby="drop4">
425             <li role="presentation"><a role="menuitem" tabindex="-1" href="http://twitter.com/fat">Action</a></li>
426             <li role="presentation"><a role="menuitem" tabindex="-1" href="http://twitter.com/fat">Another action</a></li>
427             <li role="presentation"><a role="menuitem" tabindex="-1" href="http://twitter.com/fat">Something else here</a></li>
428             <li role="presentation" class="divider"></li>
429             <li role="presentation"><a role="menuitem" tabindex="-1" href="http://twitter.com/fat">Separated link</a></li>
430           </ul>
431         </li>
432         <li class="dropdown">
433           <a id="drop5" role="button" data-toggle="dropdown" href="#">Dropdown 2 <b class="caret"></b></a>
434           <ul id="menu2" class="dropdown-menu" role="menu" aria-labelledby="drop5">
435             <li role="presentation"><a role="menuitem" tabindex="-1" href="http://twitter.com/fat">Action</a></li>
436             <li role="presentation"><a role="menuitem" tabindex="-1" href="http://twitter.com/fat">Another action</a></li>
437             <li role="presentation"><a role="menuitem" tabindex="-1" href="http://twitter.com/fat">Something else here</a></li>
438             <li role="presentation" class="divider"></li>
439             <li role="presentation"><a role="menuitem" tabindex="-1" href="http://twitter.com/fat">Separated link</a></li>
440           </ul>
441         </li>
442         <li class="dropdown">
443           <a id="drop6" role="button" data-toggle="dropdown" href="#">Dropdown 3 <b class="caret"></b></a>
444           <ul id="menu3" class="dropdown-menu" role="menu" aria-labelledby="drop6">
445             <li role="presentation"><a role="menuitem" tabindex="-1" href="http://twitter.com/fat">Action</a></li>
446             <li role="presentation"><a role="menuitem" tabindex="-1" href="http://twitter.com/fat">Another action</a></li>
447             <li role="presentation"><a role="menuitem" tabindex="-1" href="http://twitter.com/fat">Something else here</a></li>
448             <li role="presentation" class="divider"></li>
449             <li role="presentation"><a role="menuitem" tabindex="-1" href="http://twitter.com/fat">Separated link</a></li>
450           </ul>
451         </li>
452       </ul> <!-- /tabs -->
453     </div> <!-- /example -->
454
455
456     <h2 id="dropdowns-usage">Usage</h2>
457     <p>Via data attributes or JavaScript, the dropdown plugin toggles hidden content (dropdown menus) by toggling the <code>.open</code> class on the parent list item. When opened, the plugin also adds <code>.dropdown-backdrop</code> as a click area for closing dropdown menus when clicking outside the menu.</p>
458
459     <h3>Via data attributes</h3>
460     <p>Add <code>data-toggle="dropdown"</code> to a link or button to toggle a dropdown.</p>
461 {% highlight html %}
462 <div class="dropdown">
463   <a data-toggle="dropdown" href="#">Dropdown trigger</a>
464   <ul class="dropdown-menu" role="menu" aria-labelledby="dLabel">
465     ...
466   </ul>
467 </div>
468 {% endhighlight %}
469           <p>To keep URLs intact, use the <code>data-target</code> attribute instead of <code>href="#"</code>.</p>
470 {% highlight html %}
471 <div class="dropdown">
472   <a id="dLabel" role="button" data-toggle="dropdown" data-target="#" href="/page.html">
473     Dropdown <span class="caret"></span>
474   </a>
475
476
477   <ul class="dropdown-menu" role="menu" aria-labelledby="dLabel">
478     ...
479   </ul>
480 </div>
481 {% endhighlight %}
482
483     <h3>Via JavaScript</h3>
484     <p>Call the dropdowns via JavaScript:</p>
485 {% highlight js %}
486 $('.dropdown-toggle').dropdown()
487 {% endhighlight %}
488
489     <h3>Options</h3>
490     <p><em>None</em></p>
491
492     <h3>Methods</h3>
493     <h4>$().dropdown('toggle')</h4>
494     <p>Toggles the dropdown menu of a given navbar or tabbed navigation.</p>
495
496     <h3>Events</h3>
497     <div class="table-responsive">
498       <table class="table table-bordered table-striped">
499         <thead>
500           <tr>
501             <th style="width: 150px;">Event Type</th>
502             <th>Description</th>
503           </tr>
504         </thead>
505         <tbody>
506           <tr>
507             <td>show.bs.dropdown</td>
508             <td>This event fires immediately when the show instance method is called.</td>
509           </tr>
510           <tr>
511             <td>shown.bs.dropdown</td>
512             <td>This event is fired when the dropdown has been made visible to the user (will wait for CSS transitions, to complete).</td>
513           </tr>
514           <tr>
515             <td>hide.bs.dropdown</td>
516             <td>This event is fired immediately when the hide instance method has been called.</td>
517           </tr>
518           <tr>
519             <td>hidden.bs.dropdown</td>
520             <td>This event is fired when the dropdown has finished being hidden from the user (will wait for CSS transitions, to complete).</td>
521           </tr>
522         </tbody>
523       </table>
524     </div><!-- ./bs-table-responsive -->
525 {% highlight js %}
526 $('#myDropdown').on('show.bs.dropdown', function () {
527   // do something…
528 })
529 {% endhighlight %}
530   </div>
531
532   <!-- ScrollSpy
533   ================================================== -->
534   <div class="bs-docs-section">
535     <div class="page-header">
536       <h1 id="scrollspy">ScrollSpy <small>scrollspy.js</small></h1>
537     </div>
538
539
540     <h2 id="scrollspy-examples">Example in navbar</h2>
541     <p>The ScrollSpy plugin is for automatically updating nav targets based on scroll position. Scroll the area below the navbar and watch the active class change. The dropdown sub items will be highlighted as well.</p>
542     <div class="bs-example">
543       <nav id="navbar-example2" class="navbar navbar-default navbar-static" role="navigation">
544         <div class="navbar-header">
545           <button class="navbar-toggle" type="button" data-toggle="collapse" data-target=".bs-js-navbar-scrollspy">
546             <span class="sr-only">Toggle navigation</span>
547             <span class="icon-bar"></span>
548             <span class="icon-bar"></span>
549             <span class="icon-bar"></span>
550           </button>
551           <a class="navbar-brand" href="#">Project Name</a>
552         </div>
553         <div class="collapse navbar-collapse bs-js-navbar-scrollspy">
554           <ul class="nav navbar-nav">
555             <li><a href="#fat">@fat</a></li>
556             <li><a href="#mdo">@mdo</a></li>
557             <li class="dropdown">
558               <a href="#" id="navbarDrop1" class="dropdown-toggle" data-toggle="dropdown">Dropdown <b class="caret"></b></a>
559               <ul class="dropdown-menu" role="menu" aria-labelledby="navbarDrop1">
560                 <li><a href="#one" tabindex="-1">one</a></li>
561                 <li><a href="#two" tabindex="-1">two</a></li>
562                 <li class="divider"></li>
563                 <li><a href="#three" tabindex="-1">three</a></li>
564               </ul>
565             </li>
566           </ul>
567         </div>
568       </nav>
569       <div data-spy="scroll" data-target="#navbar-example2" data-offset="0" class="scrollspy-example">
570         <h4 id="fat">@fat</h4>
571         <p>Ad leggings keytar, brunch id art party dolor labore. Pitchfork yr enim lo-fi before they sold out qui. Tumblr farm-to-table bicycle rights whatever. Anim keffiyeh carles cardigan. Velit seitan mcsweeney's photo booth 3 wolf moon irure. Cosby sweater lomo jean shorts, williamsburg hoodie minim qui you probably haven't heard of them et cardigan trust fund culpa biodiesel wes anderson aesthetic. Nihil tattooed accusamus, cred irony biodiesel keffiyeh artisan ullamco consequat.</p>
572         <h4 id="mdo">@mdo</h4>
573         <p>Veniam marfa mustache skateboard, adipisicing fugiat velit pitchfork beard. Freegan beard aliqua cupidatat mcsweeney's vero. Cupidatat four loko nisi, ea helvetica nulla carles. Tattooed cosby sweater food truck, mcsweeney's quis non freegan vinyl. Lo-fi wes anderson +1 sartorial. Carles non aesthetic exercitation quis gentrify. Brooklyn adipisicing craft beer vice keytar deserunt.</p>
574         <h4 id="one">one</h4>
575         <p>Occaecat commodo aliqua delectus. Fap craft beer deserunt skateboard ea. Lomo bicycle rights adipisicing banh mi, velit ea sunt next level locavore single-origin coffee in magna veniam. High life id vinyl, echo park consequat quis aliquip banh mi pitchfork. Vero VHS est adipisicing. Consectetur nisi DIY minim messenger bag. Cred ex in, sustainable delectus consectetur fanny pack iphone.</p>
576         <h4 id="two">two</h4>
577         <p>In incididunt echo park, officia deserunt mcsweeney's proident master cleanse thundercats sapiente veniam. Excepteur VHS elit, proident shoreditch +1 biodiesel laborum craft beer. Single-origin coffee wayfarers irure four loko, cupidatat terry richardson master cleanse. Assumenda you probably haven't heard of them art party fanny pack, tattooed nulla cardigan tempor ad. Proident wolf nesciunt sartorial keffiyeh eu banh mi sustainable. Elit wolf voluptate, lo-fi ea portland before they sold out four loko. Locavore enim nostrud mlkshk brooklyn nesciunt.</p>
578         <h4 id="three">three</h4>
579         <p>Ad leggings keytar, brunch id art party dolor labore. Pitchfork yr enim lo-fi before they sold out qui. Tumblr farm-to-table bicycle rights whatever. Anim keffiyeh carles cardigan. Velit seitan mcsweeney's photo booth 3 wolf moon irure. Cosby sweater lomo jean shorts, williamsburg hoodie minim qui you probably haven't heard of them et cardigan trust fund culpa biodiesel wes anderson aesthetic. Nihil tattooed accusamus, cred irony biodiesel keffiyeh artisan ullamco consequat.</p>
580         <p>Keytar twee blog, culpa messenger bag marfa whatever delectus food truck. Sapiente synth id assumenda. Locavore sed helvetica cliche irony, thundercats you probably haven't heard of them consequat hoodie gluten-free lo-fi fap aliquip. Labore elit placeat before they sold out, terry richardson proident brunch nesciunt quis cosby sweater pariatur keffiyeh ut helvetica artisan. Cardigan craft beer seitan readymade velit. VHS chambray laboris tempor veniam. Anim mollit minim commodo ullamco thundercats.
581         </p>
582       </div>
583     </div><!-- /example -->
584
585
586     <h2 id="scrollspy-usage">Usage</h2>
587
588     <h3>Via data attributes</h3>
589     <p>To easily add scrollspy behavior to your topbar navigation, add <code>data-spy="scroll"</code> to the element you want to spy on (most typically this would be the <code>&lt;body&gt;</code>). Then add the <code>data-target</code> attribute with the ID or class of the parent element of any Bootstrap <code>.nav</code> component.</p>
590 {% highlight html %}
591 <body data-spy="scroll" data-target="#navbar-example">
592   ...
593 </body>
594 {% endhighlight %}
595
596     <h3>Via JavaScript</h3>
597     <p>Call the scrollspy via JavaScript:</p>
598 {% highlight js %}
599 $('body').scrollspy({ target: '#navbar-example' })
600 {% endhighlight %}
601
602     <div class="bs-callout bs-callout-danger">
603       <h4>Resolvable ID targets required</h4>
604       <p>Navbar links must have resolvable id targets. For example, a <code>&lt;a href="#home"&gt;home&lt;/a&gt;</code> must correspond to something in the DOM like <code>&lt;div id="home"&gt;&lt;/div&gt;</code>.</p>
605     </div>
606
607     <h3>Methods</h3>
608     <h4>.scrollspy('refresh')</h4>
609     <p>When using scrollspy in conjunction with adding or removing of elements from the DOM, you'll need to call the refresh method like so:</p>
610 {% highlight js %}
611 $('[data-spy="scroll"]').each(function () {
612   var $spy = $(this).scrollspy('refresh')
613 })
614 {% endhighlight %}
615
616
617     <h3>Options</h3>
618     <p>Options can be passed via data attributes or JavaScript. For data attributes, append the option name to <code>data-</code>, as in <code>data-offset=""</code>.</p>
619     <div class="table-responsive">
620       <table class="table table-bordered table-striped">
621         <thead>
622          <tr>
623            <th style="width: 100px;">Name</th>
624            <th style="width: 100px;">type</th>
625            <th style="width: 50px;">default</th>
626            <th>description</th>
627          </tr>
628         </thead>
629         <tbody>
630          <tr>
631            <td>offset</td>
632            <td>number</td>
633            <td>10</td>
634            <td>Pixels to offset from top when calculating position of scroll.</td>
635          </tr>
636         </tbody>
637       </table>
638     </div><!-- ./bs-table-responsive -->
639
640     <h3>Events</h3>
641     <div class="table-responsive">
642       <table class="table table-bordered table-striped">
643         <thead>
644          <tr>
645            <th style="width: 150px;">Event Type</th>
646            <th>Description</th>
647          </tr>
648         </thead>
649         <tbody>
650          <tr>
651            <td>activate.bs.scrollspy</td>
652            <td>This event fires whenever a new item becomes activated by the scrollspy.</td>
653         </tr>
654         </tbody>
655       </table>
656     </div><!-- ./bs-table-responsive -->
657 {% highlight js %}
658 $('#myScrollspy').on('activate.bs.scrollspy', function () {
659   // do something…
660 })
661 {% endhighlight %}
662   </div>
663
664
665
666   <!-- Tabs
667   ================================================== -->
668   <div class="bs-docs-section">
669     <div class="page-header">
670       <h1 id="tabs">Togglable tabs <small>tab.js</small></h1>
671     </div>
672
673     <h2 id="tabs-examples">Example tabs</h2>
674     <p>Add quick, dynamic tab functionality to transition through panes of local content, even via dropdown menus.</p>
675     <div class="bs-example bs-example-tabs">
676       <ul id="myTab" class="nav nav-tabs">
677         <li class="active"><a href="#home" data-toggle="tab">Home</a></li>
678         <li><a href="#profile" data-toggle="tab">Profile</a></li>
679         <li class="dropdown">
680           <a href="#" id="myTabDrop1" class="dropdown-toggle" data-toggle="dropdown">Dropdown <b class="caret"></b></a>
681           <ul class="dropdown-menu" role="menu" aria-labelledby="myTabDrop1">
682             <li><a href="#dropdown1" tabindex="-1" data-toggle="tab">@fat</a></li>
683             <li><a href="#dropdown2" tabindex="-1" data-toggle="tab">@mdo</a></li>
684           </ul>
685         </li>
686       </ul>
687       <div id="myTabContent" class="tab-content">
688         <div class="tab-pane fade in active" id="home">
689           <p>Raw denim you probably haven't heard of them jean shorts Austin. Nesciunt tofu stumptown aliqua, retro synth master cleanse. Mustache cliche tempor, williamsburg carles vegan helvetica. Reprehenderit butcher retro keffiyeh dreamcatcher synth. Cosby sweater eu banh mi, qui irure terry richardson ex squid. Aliquip placeat salvia cillum iphone. Seitan aliquip quis cardigan american apparel, butcher voluptate nisi qui.</p>
690         </div>
691         <div class="tab-pane fade" id="profile">
692           <p>Food truck fixie locavore, accusamus mcsweeney's marfa nulla single-origin coffee squid. Exercitation +1 labore velit, blog sartorial PBR leggings next level wes anderson artisan four loko farm-to-table craft beer twee. Qui photo booth letterpress, commodo enim craft beer mlkshk aliquip jean shorts ullamco ad vinyl cillum PBR. Homo nostrud organic, assumenda labore aesthetic magna delectus mollit. Keytar helvetica VHS salvia yr, vero magna velit sapiente labore stumptown. Vegan fanny pack odio cillum wes anderson 8-bit, sustainable jean shorts beard ut DIY ethical culpa terry richardson biodiesel. Art party scenester stumptown, tumblr butcher vero sint qui sapiente accusamus tattooed echo park.</p>
693         </div>
694         <div class="tab-pane fade" id="dropdown1">
695           <p>Etsy mixtape wayfarers, ethical wes anderson tofu before they sold out mcsweeney's organic lomo retro fanny pack lo-fi farm-to-table readymade. Messenger bag gentrify pitchfork tattooed craft beer, iphone skateboard locavore carles etsy salvia banksy hoodie helvetica. DIY synth PBR banksy irony. Leggings gentrify squid 8-bit cred pitchfork. Williamsburg banh mi whatever gluten-free, carles pitchfork biodiesel fixie etsy retro mlkshk vice blog. Scenester cred you probably haven't heard of them, vinyl craft beer blog stumptown. Pitchfork sustainable tofu synth chambray yr.</p>
696         </div>
697         <div class="tab-pane fade" id="dropdown2">
698           <p>Trust fund seitan letterpress, keytar raw denim keffiyeh etsy art party before they sold out master cleanse gluten-free squid scenester freegan cosby sweater. Fanny pack portland seitan DIY, art party locavore wolf cliche high life echo park Austin. Cred vinyl keffiyeh DIY salvia PBR, banh mi before they sold out farm-to-table VHS viral locavore cosby sweater. Lomo wolf viral, mustache readymade thundercats keffiyeh craft beer marfa ethical. Wolf salvia freegan, sartorial keffiyeh echo park vegan.</p>
699         </div>
700       </div>
701     </div><!-- /example -->
702
703     <div class="bs-callout bs-callout-info">
704       <h4>Extends tabbed navigation</h4>
705       <p>This plugin extends the <a href="../components/#nav-tabs">tabbed navigation component</a> to add tabbable areas.</p>
706     </div>
707
708
709     <h2 id="tabs-usage">Usage</h2>
710     <p>Enable tabbable tabs via JavaScript (each tab needs to be activated individually):</p>
711 {% highlight js %}
712 $('#myTab a').click(function (e) {
713   e.preventDefault()
714   $(this).tab('show')
715 })
716 {% endhighlight %}
717
718           <p>You can activate individual tabs in several ways:</p>
719 {% highlight js %}
720 $('#myTab a[href="#profile"]').tab('show') // Select tab by name
721 $('#myTab a:first').tab('show') // Select first tab
722 $('#myTab a:last').tab('show') // Select last tab
723 $('#myTab li:eq(2) a').tab('show') // Select third tab (0-indexed)
724 {% endhighlight %}
725
726     <h3>Markup</h3>
727     <p>You can activate a tab or pill navigation without writing any JavaScript by simply specifying <code>data-toggle="tab"</code> or <code>data-toggle="pill"</code> on an element. Adding the <code>nav</code> and <code>nav-tabs</code> classes to the tab <code>ul</code> will apply the Bootstrap <a href="{{ page.base_url }}components#nav-tabs">tab styling</a>, while adding the <code>nav</code> and <code>nav-pills</code> classes will apply <a href="{{ page.base_url }}components#nav-pills">pill styling</a>.</p>
728 {% highlight html %}
729 <!-- Nav tabs -->
730 <ul class="nav nav-tabs">
731   <li><a href="#home" data-toggle="tab">Home</a></li>
732   <li><a href="#profile" data-toggle="tab">Profile</a></li>
733   <li><a href="#messages" data-toggle="tab">Messages</a></li>
734   <li><a href="#settings" data-toggle="tab">Settings</a></li>
735 </ul>
736
737 <!-- Tab panes -->
738 <div class="tab-content">
739   <div class="tab-pane active" id="home">...</div>
740   <div class="tab-pane" id="profile">...</div>
741   <div class="tab-pane" id="messages">...</div>
742   <div class="tab-pane" id="settings">...</div>
743 </div>
744 {% endhighlight %}
745
746     <h3>Fade effect</h3>
747     <p>To make tabs fade in, add <code>.fade</code> to each <code>.tab-pane</code>. The first tab pane must also have <code>.in</code> to properly fade in initial content.</p>
748 {% highlight html %}
749 <div class="tab-content">
750   <div class="tab-pane fade in active" id="home">...</div>
751   <div class="tab-pane fade" id="profile">...</div>
752   <div class="tab-pane fade" id="messages">...</div>
753   <div class="tab-pane fade" id="settings">...</div>
754 </div>
755 {% endhighlight %}
756
757     <h3>Methods</h3>
758     <h4>$().tab</h4>
759     <p>
760       Activates a tab element and content container. Tab should have either a <code>data-target</code> or an <code>href</code> targeting a container node in the DOM.
761     </p>
762 {% highlight html %}
763 <ul class="nav nav-tabs" id="myTab">
764   <li class="active"><a href="#home" data-toggle="tab">Home</a></li>
765   <li><a href="#profile" data-toggle="tab">Profile</a></li>
766   <li><a href="#messages" data-toggle="tab">Messages</a></li>
767   <li><a href="#settings" data-toggle="tab">Settings</a></li>
768 </ul>
769
770 <div class="tab-content">
771   <div class="tab-pane active" id="home">...</div>
772   <div class="tab-pane" id="profile">...</div>
773   <div class="tab-pane" id="messages">...</div>
774   <div class="tab-pane" id="settings">...</div>
775 </div>
776
777 <script>
778   $(function () {
779     $('#myTab a:last').tab('show')
780   })
781 </script>
782 {% endhighlight %}
783
784     <h3>Events</h3>
785     <div class="table-responsive">
786       <table class="table table-bordered table-striped">
787         <thead>
788          <tr>
789            <th style="width: 150px;">Event Type</th>
790            <th>Description</th>
791          </tr>
792         </thead>
793         <tbody>
794          <tr>
795            <td>show.bs.tab</td>
796            <td>This event fires on tab show, but before the new tab has been shown. Use <code>event.target</code> and <code>event.relatedTarget</code> to target the active tab and the previous active tab (if available) respectively.</td>
797         </tr>
798         <tr>
799            <td>shown.bs.tab</td>
800            <td>This event fires on tab show after a tab has been shown. Use <code>event.target</code> and <code>event.relatedTarget</code> to target the active tab and the previous active tab (if available) respectively.</td>
801          </tr>
802         </tbody>
803       </table>
804     </div><!-- /.table-responsive -->
805 {% highlight js %}
806 $('a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
807   e.target // activated tab
808   e.relatedTarget // previous tab
809 })
810 {% endhighlight %}
811   </div>
812
813
814
815   <!-- Tooltips
816   ================================================== -->
817   <div class="bs-docs-section">
818     <div class="page-header">
819       <h1 id="tooltips">Tooltips <small>tooltip.js</small></h1>
820     </div>
821
822     <h2 id="tooltips-examples">Examples</h2>
823     <p>Inspired by the excellent jQuery.tipsy plugin written by Jason Frame; Tooltips are an updated version, which don't rely on images, use CSS3 for animations, and data-attributes for local title storage.</p>
824     <p>Hover over the links below to see tooltips:</p>
825     <div class="bs-example tooltip-demo">
826       <p class="muted" style="margin-bottom: 0;">Tight pants next level keffiyeh <a href="#" data-toggle="tooltip" title="Default tooltip">you probably</a> haven't heard of them. Photo booth beard raw denim letterpress vegan messenger bag stumptown. Farm-to-table seitan, mcsweeney's fixie sustainable quinoa 8-bit american apparel <a href="#" data-toggle="tooltip" title="Another tooltip">have a</a> terry richardson vinyl chambray. Beard stumptown, cardigans banh mi lomo thundercats. Tofu biodiesel williamsburg marfa, four loko mcsweeney's cleanse vegan chambray. A really ironic artisan <a href="#" data-toggle="tooltip" title="Another one here too">whatever keytar</a>, scenester farm-to-table banksy Austin <a href="#" data-toggle="tooltip" title="The last tip!">twitter handle</a> freegan cred raw denim single-origin coffee viral.
827       </p>
828     </div><!-- /example -->
829
830     <h3>Four directions</h3>
831     <div class="bs-example tooltip-demo">
832       <div class="bs-example-tooltips">
833         <button type="button" class="btn btn-default" data-toggle="tooltip" data-placement="left" title="Tooltip on left">Tooltip on left</button>
834         <button type="button" class="btn btn-default" data-toggle="tooltip" data-placement="top" title="Tooltip on top">Tooltip on top</button>
835         <button type="button" class="btn btn-default" data-toggle="tooltip" data-placement="bottom" title="Tooltip on bottom">Tooltip on bottom</button>
836         <button type="button" class="btn btn-default" data-toggle="tooltip" data-placement="right" title="Tooltip on right">Tooltip on right</button>
837       </div>
838     </div><!-- /example -->
839
840     <div class="bs-callout bs-callout-danger">
841       <h4>Opt-in functionality</h4>
842       <p>For performance reasons, the Tooltip and Popover data-apis are opt-in, meaning <strong>you must initialize them yourself</strong>.</p>
843     </div>
844     <div class="bs-callout bs-callout-info">
845       <h4>Tooltips in button groups and input groups require special setting</h4>
846       <p>When using tooltips on elements within a <code>.btn-group</code> or an <code>.input-group</code>, you'll have to specify the option <code>container: 'body'</code> (documented below) to avoid unwanted side effects (such as the element growing wider and/or losing its rounded corners when the tooltip is triggered).</p>
847     </div>
848     <div class="bs-callout bs-callout-info">
849       <h4>Tooltips on disabled elements require wrapper elements</h4>
850       <p>To add a tooltip to a <code>disabled</code> or <code>.disabled</code> element, put the element inside of a <code>&lt;div&gt;</code> and apply the tooltip to that <code>&lt;div&gt;</code> instead.</p>
851     </div>
852
853     <h2 id="tooltips-usage">Usage</h2>
854     <p>The tooltip plugin generates content and markup on demand, and by default places tooltips after their trigger element.</p>
855     <p>Trigger the tooltip via JavaScript:</p>
856 {% highlight js %}
857 $('#example').tooltip(options)
858 {% endhighlight %}
859
860     <h3>Markup</h3>
861     <p>The generated markup of a tooltip is rather simple, though it does require a position (by default, set to <code>top</code> by the plugin).</p>
862 {% highlight html linenos %}
863 <div class="tooltip">
864   <div class="tooltip-inner">
865     Tooltip!
866   </div>
867   <div class="tooltip-arrow"></div>
868 </div>
869 {% endhighlight %}
870
871     <h3>Options</h3>
872     <p>Options can be passed via data attributes or JavaScript. For data attributes, append the option name to <code>data-</code>, as in <code>data-animation=""</code>.</p>
873     <div class="table-responsive">
874       <table class="table table-bordered table-striped">
875         <thead>
876          <tr>
877            <th style="width: 100px;">Name</th>
878            <th style="width: 100px;">type</th>
879            <th style="width: 50px;">default</th>
880            <th>description</th>
881          </tr>
882         </thead>
883         <tbody>
884          <tr>
885            <td>animation</td>
886            <td>boolean</td>
887            <td>true</td>
888            <td>apply a CSS fade transition to the tooltip</td>
889          </tr>
890          <tr>
891            <td>html</td>
892            <td>boolean</td>
893            <td>false</td>
894            <td>Insert HTML into the tooltip. If false, jQuery's <code>text</code> method will be used to insert content into the DOM. Use text if you're worried about XSS attacks.</td>
895          </tr>
896          <tr>
897            <td>placement</td>
898            <td>string | function</td>
899            <td>'top'</td>
900            <td>how to position the tooltip - top | bottom | left | right | auto. <br> When "auto" is specified, it will dynamically reorient the tooltip. For example, if placement is "auto left", the tooltip will display to the left when possible, otherwise it will display right.</td>
901          </tr>
902          <tr>
903            <td>selector</td>
904            <td>string</td>
905            <td>false</td>
906            <td>If a selector is provided, tooltip objects will be delegated to the specified targets.</td>
907          </tr>
908          <tr>
909            <td>title</td>
910            <td>string | function</td>
911            <td>''</td>
912            <td>default title value if <code>title</code> attribute isn't present</td>
913          </tr>
914          <tr>
915            <td>trigger</td>
916            <td>string</td>
917            <td>'hover focus'</td>
918            <td>how tooltip is triggered - click | hover | focus | manual. You may pass multiple triggers; separate them with a space.</td>
919          </tr>
920          <tr>
921            <td>delay</td>
922            <td>number | object</td>
923            <td>0</td>
924            <td>
925             <p>delay showing and hiding the tooltip (ms) - does not apply to manual trigger type</p>
926             <p>If a number is supplied, delay is applied to both hide/show</p>
927             <p>Object structure is: <code>delay: { show: 500, hide: 100 }</code></p>
928            </td>
929          </tr>
930          <tr>
931            <td>container</td>
932            <td>string | false</td>
933            <td>false</td>
934            <td>
935             <p>Appends the tooltip to a specific element. Example: <code>container: 'body'</code></p>
936            </td>
937          </tr>
938         </tbody>
939       </table>
940     </div><!-- /.table-responsive -->
941     <div class="bs-callout bs-callout-info">
942       <h4>Data attributes for individual tooltips</h4>
943       <p>Options for individual tooltips can alternatively be specified through the use of data attributes, as explained above.</p>
944     </div>
945
946     <h3>Markup</h3>
947 {% highlight html %}
948 <a href="#" data-toggle="tooltip" title="first tooltip">Hover over me</a>
949 {% endhighlight %}
950
951     <h3>Methods</h3>
952
953     <h4>$().tooltip(options)</h4>
954     <p>Attaches a tooltip handler to an element collection.</p>
955
956     <h4>.tooltip('show')</h4>
957     <p>Reveals an element's tooltip.</p>
958     {% highlight js %}$('#element').tooltip('show'){% endhighlight %}
959
960     <h4>.tooltip('hide')</h4>
961     <p>Hides an element's tooltip.</p>
962     {% highlight js %}$('#element').tooltip('hide'){% endhighlight %}
963
964     <h4>.tooltip('toggle')</h4>
965     <p>Toggles an element's tooltip.</p>
966     {% highlight js %}$('#element').tooltip('toggle'){% endhighlight %}
967
968     <h4>.tooltip('destroy')</h4>
969     <p>Hides and destroys an element's tooltip.</p>
970     {% highlight js %}$('#element').tooltip('destroy'){% endhighlight %}
971
972     <h3>Events</h3>
973     <div class="table-responsive">
974       <table class="table table-bordered table-striped">
975         <thead>
976          <tr>
977            <th style="width: 150px;">Event Type</th>
978            <th>Description</th>
979          </tr>
980         </thead>
981         <tbody>
982          <tr>
983            <td>show.bs.tooltip</td>
984            <td>This event fires immediately when the <code>show</code> instance method is called.</td>
985          </tr>
986          <tr>
987            <td>shown.bs.tooltip</td>
988            <td>This event is fired when the tooltip has been made visible to the user (will wait for CSS transitions to complete).</td>
989          </tr>
990          <tr>
991            <td>hide.bs.tooltip</td>
992            <td>This event is fired immediately when the <code>hide</code> instance method has been called.</td>
993          </tr>
994          <tr>
995            <td>hidden.bs.tooltip</td>
996            <td>This event is fired when the tooltip has finished being hidden from the user (will wait for CSS transitions to complete).</td>
997          </tr>
998         </tbody>
999       </table>
1000     </div><!-- /.table-responsive -->
1001 {% highlight js %}
1002 $('#myTooltip').on('hidden.bs.tooltip', function () {
1003   // do something…
1004 })
1005 {% endhighlight %}
1006   </div>
1007
1008   <!-- Popovers
1009   ================================================== -->
1010   <div class="bs-docs-section">
1011     <div class="page-header">
1012       <h1 id="popovers">Popovers <small>popover.js</small></h1>
1013     </div>
1014
1015     <h2 id="popovers-examples">Examples</h2>
1016     <p>Add small overlays of content, like those on the iPad, to any element for housing secondary information.</p>
1017
1018     <div class="bs-callout bs-callout-danger">
1019       <h4>Plugin dependency</h4>
1020       <p>Popovers require the <a href="#tooltips">tooltip plugin</a> to be included in your version of Bootstrap.</p>
1021     </div>
1022     <div class="bs-callout bs-callout-danger">
1023       <h4>Opt-in functionality</h4>
1024       <p>For performance reasons, the Tooltip and Popover data-apis are opt-in, meaning <strong>you must initialize them yourself</strong>.</p>
1025     </div>
1026     <div class="bs-callout bs-callout-info">
1027       <h4>Popovers in button groups and input groups require special setting</h4>
1028       <p>When using popovers on elements within a <code>.btn-group</code> or an <code>.input-group</code>, you'll have to specify the option <code>container: 'body'</code> (documented below) to avoid unwanted side effects (such as the element growing wider and/or losing its rounded corners when the popover is triggered).</p>
1029     </div>
1030     <div class="bs-callout bs-callout-info">
1031       <h4>Popovers on disabled elements require wrapper elements</h4>
1032       <p>To add a popover to a <code>disabled</code> or <code>.disabled</code> element, put the element inside of a <code>&lt;div&gt;</code> and apply the popover to that <code>&lt;div&gt;</code> instead.</p>
1033     </div>
1034
1035     <h3>Static popover</h3>
1036     <p>Four options are available: top, right, bottom, and left aligned.</p>
1037     <div class="bs-example bs-example-popover">
1038       <div class="popover top">
1039         <div class="arrow"></div>
1040         <h3 class="popover-title">Popover top</h3>
1041         <div class="popover-content">
1042           <p>Sed posuere consectetur est at lobortis. Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis vestibulum.</p>
1043         </div>
1044       </div>
1045
1046       <div class="popover right">
1047         <div class="arrow"></div>
1048         <h3 class="popover-title">Popover right</h3>
1049         <div class="popover-content">
1050           <p>Sed posuere consectetur est at lobortis. Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis vestibulum.</p>
1051         </div>
1052       </div>
1053
1054       <div class="popover bottom">
1055         <div class="arrow"></div>
1056         <h3 class="popover-title">Popover bottom</h3>
1057
1058         <div class="popover-content">
1059           <p>Sed posuere consectetur est at lobortis. Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis vestibulum.</p>
1060         </div>
1061       </div>
1062
1063       <div class="popover left">
1064         <div class="arrow"></div>
1065         <h3 class="popover-title">Popover left</h3>
1066         <div class="popover-content">
1067           <p>Sed posuere consectetur est at lobortis. Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis vestibulum.</p>
1068         </div>
1069       </div>
1070
1071       <div class="clearfix"></div>
1072     </div>
1073
1074     <h3>Live demo</h3>
1075     <div class="bs-example" style="padding-bottom: 24px;">
1076       <a href="#" class="btn btn-lg btn-danger" data-toggle="popover" title="A Title" data-content="And here's some amazing content. It's very engaging. right?" role="button">Click to toggle popover</a>
1077     </div>
1078
1079     <h4>Four directions</h4>
1080     <div class="bs-example tooltip-demo">
1081       <div class="bs-example-tooltips">
1082         <button type="button" class="btn btn-default" data-container="body" data-toggle="popover" data-placement="left" data-content="Vivamus sagittis lacus vel augue laoreet rutrum faucibus.">
1083           Popover on left
1084         </button>
1085         <button type="button" class="btn btn-default" data-container="body" data-toggle="popover" data-placement="top" data-content="Vivamus sagittis lacus vel augue laoreet rutrum faucibus.">
1086           Popover on top
1087         </button>
1088         <button type="button" class="btn btn-default" data-container="body" data-toggle="popover" data-placement="bottom" data-content="Vivamus sagittis lacus vel augue laoreet rutrum faucibus.">
1089           Popover on bottom
1090         </button>
1091         <button type="button" class="btn btn-default" data-container="body" data-toggle="popover" data-placement="right" data-content="Vivamus sagittis lacus vel augue laoreet rutrum faucibus.">
1092           Popover on right
1093         </button>
1094       </div>
1095     </div><!-- /example -->
1096
1097
1098     <h2 id="popovers-usage">Usage</h2>
1099     <p>Enable popovers via JavaScript:</p>
1100     {% highlight js %}$('#example').popover(options){% endhighlight %}
1101
1102     <h3>Options</h3>
1103     <p>Options can be passed via data attributes or JavaScript. For data attributes, append the option name to <code>data-</code>, as in <code>data-animation=""</code>.</p>
1104     <div class="table-responsive">
1105       <table class="table table-bordered table-striped">
1106         <thead>
1107           <tr>
1108             <th style="width: 100px;">Name</th>
1109             <th style="width: 100px;">type</th>
1110             <th style="width: 50px;">default</th>
1111             <th>description</th>
1112           </tr>
1113         </thead>
1114         <tbody>
1115           <tr>
1116             <td>animation</td>
1117             <td>boolean</td>
1118             <td>true</td>
1119             <td>apply a CSS fade transition to the tooltip</td>
1120           </tr>
1121           <tr>
1122             <td>html</td>
1123             <td>boolean</td>
1124             <td>false</td>
1125             <td>Insert HTML into the popover. If false, jQuery's <code>text</code> method will be used to insert content into the DOM. Use text if you're worried about XSS attacks.</td>
1126           </tr>
1127           <tr>
1128             <td>placement</td>
1129             <td>string | function</td>
1130             <td>'right'</td>
1131             <td>how to position the popover - top | bottom | left | right | auto.<br> When "auto" is specified, it will dynamically reorient the popover. For example, if placement is "auto left", the tooltip will display to the left when possible, otherwise it will display right.</td>
1132           </tr>
1133           <tr>
1134             <td>selector</td>
1135             <td>string</td>
1136             <td>false</td>
1137             <td>if a selector is provided, tooltip objects will be delegated to the specified targets. in practice, this is used to enable dynamic HTML content to have popovers added. See <a href="https://github.com/twbs/bootstrap/issues/4215">this</a> and <a href="http://jsfiddle.net/fScua/">an informative example</a>.</td>
1138           </tr>
1139           <tr>
1140             <td>trigger</td>
1141             <td>string</td>
1142             <td>'click'</td>
1143             <td>how popover is triggered - click | hover | focus | manual</td>
1144           </tr>
1145           <tr>
1146             <td>title</td>
1147             <td>string | function</td>
1148             <td>''</td>
1149             <td>default title value if <code>title</code> attribute isn't present</td>
1150           </tr>
1151           <tr>
1152             <td>content</td>
1153             <td>string | function</td>
1154             <td>''</td>
1155             <td>default content value if <code>data-content</code> attribute isn't present</td>
1156           </tr>
1157           <tr>
1158             <td>delay</td>
1159             <td>number | object</td>
1160             <td>0</td>
1161             <td>
1162              <p>delay showing and hiding the popover (ms) - does not apply to manual trigger type</p>
1163              <p>If a number is supplied, delay is applied to both hide/show</p>
1164              <p>Object structure is: <code>delay: { show: 500, hide: 100 }</code></p>
1165             </td>
1166           </tr>
1167           <tr>
1168             <td>container</td>
1169             <td>string | false</td>
1170             <td>false</td>
1171             <td>
1172              <p>Appends the popover to a specific element. Example: <code>container: 'body'</code>. This option is particularly useful in that it allows you to position the popover in the flow of the document near the triggering element - which will prevent the popover from floating away from the triggering element during a window resize.</p>
1173             </td>
1174           </tr>
1175         </tbody>
1176       </table>
1177     </div><!-- /.table-responsive -->
1178     <div class="bs-callout bs-callout-info">
1179       <h4>Data attributes for individual popovers</h4>
1180       <p>Options for individual popovers can alternatively be specified through the use of data attributes, as explained above.</p>
1181     </div>
1182
1183     <h3>Methods</h3>
1184     <h4>$().popover(options)</h4>
1185     <p>Initializes popovers for an element collection.</p>
1186
1187     <h4>.popover('show')</h4>
1188     <p>Reveals an elements popover.</p>
1189     {% highlight js %}$('#element').popover('show'){% endhighlight %}
1190
1191     <h4>.popover('hide')</h4>
1192     <p>Hides an elements popover.</p>
1193     {% highlight js %}$('#element').popover('hide'){% endhighlight %}
1194
1195     <h4>.popover('toggle')</h4>
1196     <p>Toggles an elements popover.</p>
1197     {% highlight js %}$('#element').popover('toggle'){% endhighlight %}
1198
1199     <h4>.popover('destroy')</h4>
1200     <p>Hides and destroys an element's popover.</p>
1201     {% highlight js %}$('#element').popover('destroy'){% endhighlight %}
1202     <h3>Events</h3>
1203     <div class="table-responsive">
1204       <table class="table table-bordered table-striped">
1205         <thead>
1206          <tr>
1207            <th style="width: 150px;">Event Type</th>
1208            <th>Description</th>
1209          </tr>
1210         </thead>
1211         <tbody>
1212          <tr>
1213            <td>show.bs.popover</td>
1214            <td>This event fires immediately when the <code>show</code> instance method is called.</td>
1215          </tr>
1216          <tr>
1217            <td>shown.bs.popover</td>
1218            <td>This event is fired when the popover has been made visible to the user (will wait for CSS transitions to complete).</td>
1219          </tr>
1220          <tr>
1221            <td>hide.bs.popover</td>
1222            <td>This event is fired immediately when the <code>hide</code> instance method has been called.</td>
1223          </tr>
1224          <tr>
1225            <td>hidden.bs.popover</td>
1226            <td>This event is fired when the popover has finished being hidden from the user (will wait for CSS transitions to complete).</td>
1227          </tr>
1228         </tbody>
1229       </table>
1230     </div><!-- /.table-responsive -->
1231 {% highlight js %}
1232 $('#myPopover').on('hidden.bs.popover', function () {
1233   // do something…
1234 })
1235 {% endhighlight %}
1236   </div>
1237
1238   <!-- Alert
1239   ================================================== -->
1240   <div class="bs-docs-section">
1241     <div class="page-header">
1242       <h1 id="alerts">Alert messages <small>alert.js</small></h1>
1243     </div>
1244
1245
1246     <h2 id="alerts-examples">Example alerts</h2>
1247     <p>Add dismiss functionality to all alert messages with this plugin.</p>
1248     <div class="bs-example">
1249       <div class="alert alert-warning fade in">
1250         <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
1251         <strong>Holy guacamole!</strong> Best check yo self, you're not looking too good.
1252       </div>
1253     </div><!-- /example -->
1254
1255     <div class="bs-example">
1256       <div class="alert alert-danger fade in">
1257         <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
1258         <h4>Oh snap! You got an error!</h4>
1259         <p>Change this and that and try again. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit. Cras mattis consectetur purus sit amet fermentum.</p>
1260         <p>
1261           <button type="button" class="btn btn-danger">Take this action</button>
1262           <button type="button" class="btn btn-default">Or do this</button>
1263         </p>
1264       </div>
1265     </div><!-- /example -->
1266
1267
1268     <h2 id="alerts-usage">Usage</h2>
1269     <p>Enable dismissal of an alert via JavaScript:</p>
1270     {% highlight js %}$(".alert").alert(){% endhighlight %}
1271
1272     <h3>Markup</h3>
1273     <p>Just add <code>data-dismiss="alert"</code> to your close button to automatically give an alert close functionality.</p>
1274     {% highlight html %}<a class="close" data-dismiss="alert" href="#" aria-hidden="true">&times;</a>{% endhighlight %}
1275
1276     <h3>Methods</h3>
1277
1278     <h4>$().alert()</h4>
1279     <p>Wraps all alerts with close functionality. To have your alerts animate out when closed, make sure they have the <code>.fade</code> and <code>.in</code> class already applied to them.</p>
1280
1281     <h4>.alert('close')</h4>
1282     <p>Closes an alert.</p>
1283     {% highlight js %}$(".alert").alert('close'){% endhighlight %}
1284
1285
1286     <h3>Events</h3>
1287     <p>Bootstrap's alert class exposes a few events for hooking into alert functionality.</p>
1288     <div class="table-responsive">
1289       <table class="table table-bordered table-striped">
1290         <thead>
1291           <tr>
1292             <th style="width: 150px;">Event Type</th>
1293             <th>Description</th>
1294           </tr>
1295         </thead>
1296         <tbody>
1297           <tr>
1298             <td>close.bs.alert</td>
1299             <td>This event fires immediately when the <code>close</code> instance method is called.</td>
1300           </tr>
1301           <tr>
1302             <td>closed.bs.alert</td>
1303             <td>This event is fired when the alert has been closed (will wait for CSS transitions to complete).</td>
1304           </tr>
1305         </tbody>
1306       </table>
1307     </div><!-- /.table-responsive -->
1308 {% highlight js %}
1309 $('#my-alert').bind('closed.bs.alert', function () {
1310   // do something…
1311 })
1312 {% endhighlight %}
1313   </div>
1314
1315
1316
1317   <!-- Buttons
1318   ================================================== -->
1319   <div class="bs-docs-section">
1320     <div class="page-header">
1321       <h1 id="buttons">Buttons <small>button.js</small></h1>
1322     </div>
1323
1324     <h2 id="buttons-examples">Example uses</h2>
1325     <p>Do more with buttons. Control button states or create groups of buttons for more components like toolbars.</p>
1326
1327     <h4>Stateful</h4>
1328     <p>Add <code>data-loading-text="Loading..."</code> to use a loading state on a button.</p>
1329     <div class="bs-example" style="padding-bottom: 24px;">
1330       <button type="button" id="fat-btn" data-loading-text="Loading..." class="btn btn-primary">
1331         Loading state
1332       </button>
1333     </div><!-- /example -->
1334 {% highlight html %}
1335 <button type="button" data-loading-text="Loading..." class="btn btn-primary">
1336   Loading state
1337 </button>
1338 {% endhighlight %}
1339
1340     <h4>Single toggle</h4>
1341     <p>Add <code>data-toggle="button"</code> to activate toggling on a single button.</p>
1342     <div class="bs-example" style="padding-bottom: 24px;">
1343       <button type="button" class="btn btn-primary" data-toggle="button">Single toggle</button>
1344     </div><!-- /example -->
1345 {% highlight html %}
1346 <button type="button" class="btn btn-primary" data-toggle="button">Single toggle</button>
1347 {% endhighlight %}
1348
1349     <h4>Checkbox</h4>
1350     <p>Add <code>data-toggle="buttons"</code> to a group of checkboxes for checkbox style toggling on btn-group.</p>
1351     <div class="bs-example" style="padding-bottom: 24px;">
1352       <div class="btn-group" data-toggle="buttons">
1353         <label class="btn btn-primary">
1354           <input type="checkbox"> Option 1
1355         </label>
1356         <label class="btn btn-primary">
1357           <input type="checkbox"> Option 2
1358         </label>
1359         <label class="btn btn-primary">
1360           <input type="checkbox"> Option 3
1361         </label>
1362       </div>
1363     </div><!-- /example -->
1364 {% highlight html %}
1365 <div class="btn-group" data-toggle="buttons">
1366   <label class="btn btn-primary">
1367     <input type="checkbox"> Option 1
1368   </label>
1369   <label class="btn btn-primary">
1370     <input type="checkbox"> Option 2
1371   </label>
1372   <label class="btn btn-primary">
1373     <input type="checkbox"> Option 3
1374   </label>
1375 </div>
1376 {% endhighlight %}
1377
1378     <h4>Radio</h4>
1379     <p>Add <code>data-toggle="buttons"</code> to a group of radio inputs for radio style toggling on btn-group.</p>
1380     <div class="bs-example" style="padding-bottom: 24px;">
1381       <div class="btn-group" data-toggle="buttons">
1382         <label class="btn btn-primary">
1383           <input type="radio" name="options" id="option1"> Option 1
1384         </label>
1385         <label class="btn btn-primary">
1386           <input type="radio" name="options" id="option2"> Option 2
1387         </label>
1388         <label class="btn btn-primary">
1389           <input type="radio" name="options" id="option3"> Option 3
1390         </label>
1391       </div>
1392     </div><!-- /example -->
1393 {% highlight html %}
1394 <div class="btn-group" data-toggle="buttons">
1395   <label class="btn btn-primary">
1396     <input type="radio" name="options" id="option1"> Option 1
1397   </label>
1398   <label class="btn btn-primary">
1399     <input type="radio" name="options" id="option2"> Option 2
1400   </label>
1401   <label class="btn btn-primary">
1402     <input type="radio" name="options" id="option3"> Option 3
1403   </label>
1404 </div>
1405 {% endhighlight %}
1406
1407
1408     <h2 id="buttons-usage">Usage</h2>
1409     <p>Enable buttons via JavaScript:</p>
1410 {% highlight js %}
1411 $('.btn-group').button()
1412 {% endhighlight %}
1413
1414     <h3>Markup</h3>
1415     <p>Data attributes are integral to the button plugin. Check out the example code below for the various markup types.</p>
1416
1417     <h3>Options</h3>
1418     <p><em>None</em></p>
1419
1420     <h3>Methods</h3>
1421
1422     <h4>$().button('toggle')</h4>
1423     <p>Toggles push state. Gives the button the appearance that it has been activated.</p>
1424     <div class="bs-callout bs-callout-info">
1425       <h4>Auto toggling</h4>
1426       <p>You can enable auto toggling of a button by using the <code>data-toggle</code> attribute.</p>
1427     </div>
1428 {% highlight html %}
1429 <button type="button" class="btn" data-toggle="button">...</button>
1430 {% endhighlight %}
1431
1432     <h4>$().button('loading')</h4>
1433     <p>Sets button state to loading - disables button and swaps text to loading text. Loading text should be defined on the button element using the data attribute <code>data-loading-text</code>.
1434     </p>
1435 {% highlight html %}
1436 <button type="button" class="btn" data-loading-text="loading stuff...">...</button>
1437 {% endhighlight %}
1438
1439     <div class="bs-callout bs-callout-danger">
1440       <h4>Cross-browser compatibility</h4>
1441       <p><a href="https://github.com/twbs/bootstrap/issues/793">Firefox persists the disabled state across page loads</a>. A workaround for this is to use <code>autocomplete="off"</code>.</p>
1442     </div>
1443
1444     <h4>$().button('reset')</h4>
1445     <p>Resets button state - swaps text to original text.</p>
1446
1447     <h4>$().button(string)</h4>
1448     <p>Resets button state - swaps text to any data defined text state.</p>
1449 {% highlight html %}
1450 <button type="button" class="btn" data-complete-text="finished!" >...</button>
1451 <script>
1452   $('.btn').button('complete')
1453 </script>
1454 {% endhighlight %}
1455   </div>
1456
1457
1458
1459   <!-- Collapse
1460   ================================================== -->
1461   <div class="bs-docs-section">
1462     <div class="page-header">
1463       <h1 id="collapse">Collapse <small>collapse.js</small></h1>
1464     </div>
1465
1466     <h3>About</h3>
1467     <p>Get base styles and flexible support for collapsible components like accordions and navigation.</p>
1468
1469     <div class="bs-callout bs-callout-danger">
1470       <h4>Plugin dependency</h4>
1471       <p>Collapse requires the <a href="#transitions">transitions plugin</a> to be included in your version of Bootstrap.</p>
1472     </div>
1473
1474     <h2 id="collapse-examples">Example accordion</h2>
1475     <p>Using the collapse plugin, we built a simple accordion by extending the panel component.</p>
1476
1477     <div class="bs-example">
1478       <div class="panel-group" id="accordion">
1479         <div class="panel panel-default">
1480           <div class="panel-heading">
1481             <h4 class="panel-title">
1482               <a data-toggle="collapse" data-parent="#accordion" href="#collapseOne">
1483                 Collapsible Group Item #1
1484               </a>
1485             </h4>
1486           </div>
1487           <div id="collapseOne" class="panel-collapse collapse in">
1488             <div class="panel-body">
1489               Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor, sunt aliqua put a bird on it squid single-origin coffee nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident. Ad vegan excepteur butcher vice lomo. Leggings occaecat craft beer farm-to-table, raw denim aesthetic synth nesciunt you probably haven't heard of them accusamus labore sustainable VHS.
1490             </div>
1491           </div>
1492         </div>
1493         <div class="panel panel-default">
1494           <div class="panel-heading">
1495             <h4 class="panel-title">
1496               <a data-toggle="collapse" data-parent="#accordion" href="#collapseTwo">
1497                 Collapsible Group Item #2
1498               </a>
1499             </h4>
1500           </div>
1501           <div id="collapseTwo" class="panel-collapse collapse">
1502             <div class="panel-body">
1503               Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor, sunt aliqua put a bird on it squid single-origin coffee nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident. Ad vegan excepteur butcher vice lomo. Leggings occaecat craft beer farm-to-table, raw denim aesthetic synth nesciunt you probably haven't heard of them accusamus labore sustainable VHS.
1504             </div>
1505           </div>
1506         </div>
1507         <div class="panel panel-default">
1508           <div class="panel-heading">
1509             <h4 class="panel-title">
1510               <a data-toggle="collapse" data-parent="#accordion" href="#collapseThree">
1511                 Collapsible Group Item #3
1512               </a>
1513             </h4>
1514           </div>
1515           <div id="collapseThree" class="panel-collapse collapse">
1516             <div class="panel-body">
1517               Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor, sunt aliqua put a bird on it squid single-origin coffee nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident. Ad vegan excepteur butcher vice lomo. Leggings occaecat craft beer farm-to-table, raw denim aesthetic synth nesciunt you probably haven't heard of them accusamus labore sustainable VHS.
1518             </div>
1519           </div>
1520         </div>
1521       </div>
1522     </div><!-- /example -->
1523 {% highlight html %}
1524 <div class="panel-group" id="accordion">
1525   <div class="panel panel-default">
1526     <div class="panel-heading">
1527       <h4 class="panel-title">
1528         <a data-toggle="collapse" data-parent="#accordion" href="#collapseOne">
1529           Collapsible Group Item #1
1530         </a>
1531       </h4>
1532     </div>
1533     <div id="collapseOne" class="panel-collapse collapse in">
1534       <div class="panel-body">
1535         Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor, sunt aliqua put a bird on it squid single-origin coffee nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident. Ad vegan excepteur butcher vice lomo. Leggings occaecat craft beer farm-to-table, raw denim aesthetic synth nesciunt you probably haven't heard of them accusamus labore sustainable VHS.
1536       </div>
1537     </div>
1538   </div>
1539   <div class="panel panel-default">
1540     <div class="panel-heading">
1541       <h4 class="panel-title">
1542         <a data-toggle="collapse" data-parent="#accordion" href="#collapseTwo">
1543           Collapsible Group Item #2
1544         </a>
1545       </h4>
1546     </div>
1547     <div id="collapseTwo" class="panel-collapse collapse">
1548       <div class="panel-body">
1549         Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor, sunt aliqua put a bird on it squid single-origin coffee nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident. Ad vegan excepteur butcher vice lomo. Leggings occaecat craft beer farm-to-table, raw denim aesthetic synth nesciunt you probably haven't heard of them accusamus labore sustainable VHS.
1550       </div>
1551     </div>
1552   </div>
1553   <div class="panel panel-default">
1554     <div class="panel-heading">
1555       <h4 class="panel-title">
1556         <a data-toggle="collapse" data-parent="#accordion" href="#collapseThree">
1557           Collapsible Group Item #3
1558         </a>
1559       </h4>
1560     </div>
1561     <div id="collapseThree" class="panel-collapse collapse">
1562       <div class="panel-body">
1563         Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor, sunt aliqua put a bird on it squid single-origin coffee nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident. Ad vegan excepteur butcher vice lomo. Leggings occaecat craft beer farm-to-table, raw denim aesthetic synth nesciunt you probably haven't heard of them accusamus labore sustainable VHS.
1564       </div>
1565     </div>
1566   </div>
1567 </div>
1568 {% endhighlight %}
1569
1570     <p>You can also use the plugin without the accordion markup. Make a button toggle the expanding and collapsing of another element.</p>
1571 {% highlight html %}
1572 <button type="button" class="btn btn-danger" data-toggle="collapse" data-target="#demo">
1573   simple collapsible
1574 </button>
1575
1576 <div id="demo" class="collapse in">...</div>
1577 {% endhighlight %}
1578
1579
1580     <h2 id="collapse-usage">Usage</h2>
1581     <p>The collapse plugin utilizes a few classes to handle the heavy lifting:</p>
1582     <ul>
1583       <li><code>.collapse</code> hides the content</li>
1584       <li><code>.collapse.in</code> shows the content</li>
1585       <li><code>.collapsing</code> is added when the transition starts, and removed when it finishes</li>
1586     </ul>
1587     <p>These classes can be found in <code>component-animations.less</code>.</p>
1588
1589     <h3>Via data attributes</h3>
1590     <p>Just add <code>data-toggle="collapse"</code> and a <code>data-target</code> to element to automatically assign control of a collapsible element. The <code>data-target</code> attribute accepts a CSS selector to apply the collapse to. Be sure to add the class <code>collapse</code> to the collapsible element. If you'd like it to default open, add the additional class <code>in</code>.</p>
1591     <p>To add accordion-like group management to a collapsible control, add the data attribute <code>data-parent="#selector"</code>. Refer to the demo to see this in action.</p>
1592
1593     <h3>Via JavaScript</h3>
1594     <p>Enable manually with:</p>
1595 {% highlight js %}
1596 $(".collapse").collapse()
1597 {% endhighlight %}
1598
1599     <h3>Options</h3>
1600     <p>Options can be passed via data attributes or JavaScript. For data attributes, append the option name to <code>data-</code>, as in <code>data-parent=""</code>.</p>
1601     <div class="table-responsive">
1602       <table class="table table-bordered table-striped">
1603         <thead>
1604          <tr>
1605            <th style="width: 100px;">Name</th>
1606            <th style="width: 50px;">type</th>
1607            <th style="width: 50px;">default</th>
1608            <th>description</th>
1609          </tr>
1610         </thead>
1611         <tbody>
1612          <tr>
1613            <td>parent</td>
1614            <td>selector</td>
1615            <td>false</td>
1616            <td>If selector then all collapsible elements under the specified parent will be closed when this collapsible item is shown. (similar to traditional accordion behavior - this dependent on the <code>accordion-group</code> class)</td>
1617          </tr>
1618          <tr>
1619            <td>toggle</td>
1620            <td>boolean</td>
1621            <td>true</td>
1622            <td>Toggles the collapsible element on invocation</td>
1623          </tr>
1624         </tbody>
1625       </table>
1626     </div><!-- /.table-responsive -->
1627
1628     <h3>Methods</h3>
1629
1630     <h4>.collapse(options)</h4>
1631     <p>Activates your content as a collapsible element. Accepts an optional options <code>object</code>.
1632 {% highlight js %}
1633 $('#myCollapsible').collapse({
1634   toggle: false
1635 })
1636 {% endhighlight %}
1637
1638     <h4>.collapse('toggle')</h4>
1639     <p>Toggles a collapsible element to shown or hidden.</p>
1640
1641     <h4>.collapse('show')</h4>
1642     <p>Shows a collapsible element.</p>
1643
1644     <h4>.collapse('hide')</h4>
1645     <p>Hides a collapsible element.</p>
1646
1647     <h3>Events</h3>
1648     <p>Bootstrap's collapse class exposes a few events for hooking into collapse functionality.</p>
1649     <div class="table-responsive">
1650       <table class="table table-bordered table-striped">
1651         <thead>
1652          <tr>
1653            <th style="width: 150px;">Event Type</th>
1654            <th>Description</th>
1655          </tr>
1656         </thead>
1657         <tbody>
1658          <tr>
1659            <td>show.bs.collapse</td>
1660            <td>This event fires immediately when the <code>show</code> instance method is called.</td>
1661          </tr>
1662          <tr>
1663            <td>shown.bs.collapse</td>
1664            <td>This event is fired when a collapse element has been made visible to the user (will wait for CSS transitions to complete).</td>
1665          </tr>
1666          <tr>
1667            <td>hide.bs.collapse</td>
1668            <td>
1669             This event is fired immediately when the <code>hide</code> method has been called.
1670            </td>
1671          </tr>
1672          <tr>
1673            <td>hidden.bs.collapse</td>
1674            <td>This event is fired when a collapse element has been hidden from the user (will wait for CSS transitions to complete).</td>
1675          </tr>
1676         </tbody>
1677       </table>
1678     </div><!-- /.table-responsive -->
1679 {% highlight js %}
1680 $('#myCollapsible').on('hidden.bs.collapse', function () {
1681   // do something…
1682 })
1683 {% endhighlight %}
1684   </div>
1685
1686
1687
1688   <!-- Carousel
1689   ================================================== -->
1690   <div class="bs-docs-section">
1691     <div class="page-header">
1692       <h1 id="carousel">Carousel <small>carousel.js</small></h1>
1693     </div>
1694
1695     <h2 id="carousel-examples">Examples</h2>
1696     <p>The slideshow below shows a generic plugin and component for cycling through elements like a carousel.</p>
1697     <div class="bs-example">
1698       <div id="carousel-example-generic" class="carousel slide" data-ride="carousel">
1699         <ol class="carousel-indicators">
1700           <li data-target="#carousel-example-generic" data-slide-to="0" class="active"></li>
1701           <li data-target="#carousel-example-generic" data-slide-to="1"></li>
1702           <li data-target="#carousel-example-generic" data-slide-to="2"></li>
1703         </ol>
1704         <div class="carousel-inner">
1705           <div class="item active">
1706             <img data-src="holder.js/900x500/auto/#777:#555/text:First slide" alt="First slide">
1707           </div>
1708           <div class="item">
1709             <img data-src="holder.js/900x500/auto/#666:#444/text:Second slide" alt="Second slide">
1710           </div>
1711           <div class="item">
1712             <img data-src="holder.js/900x500/auto/#555:#333/text:Third slide" alt="Third slide">
1713           </div>
1714         </div>
1715         <a class="left carousel-control" href="#carousel-example-generic" data-slide="prev">
1716           <span class="glyphicon glyphicon-chevron-left"></span>
1717         </a>
1718         <a class="right carousel-control" href="#carousel-example-generic" data-slide="next">
1719           <span class="glyphicon glyphicon-chevron-right"></span>
1720         </a>
1721       </div>
1722     </div><!-- /example -->
1723 {% highlight html %}
1724 <div id="carousel-example-generic" class="carousel slide" data-ride="carousel">
1725   <!-- Indicators -->
1726   <ol class="carousel-indicators">
1727     <li data-target="#carousel-example-generic" data-slide-to="0" class="active"></li>
1728     <li data-target="#carousel-example-generic" data-slide-to="1"></li>
1729     <li data-target="#carousel-example-generic" data-slide-to="2"></li>
1730   </ol>
1731
1732   <!-- Wrapper for slides -->
1733   <div class="carousel-inner">
1734     <div class="item active">
1735       <img src="..." alt="...">
1736       <div class="carousel-caption">
1737         ...
1738       </div>
1739     </div>
1740     ...
1741   </div>
1742
1743   <!-- Controls -->
1744   <a class="left carousel-control" href="#carousel-example-generic" data-slide="prev">
1745     <span class="glyphicon glyphicon-chevron-left"></span>
1746   </a>
1747   <a class="right carousel-control" href="#carousel-example-generic" data-slide="next">
1748     <span class="glyphicon glyphicon-chevron-right"></span>
1749   </a>
1750 </div>
1751 {% endhighlight %}
1752 <div class="bs-callout bs-callout-warning" id="callout-carousel-transitions">
1753   <h4>Transition animations not supported in Internet Explorer 8 &amp; 9</h4>
1754   <p>Bootstrap exclusively uses CSS3 for its animations, but Internet Explorer 8 &amp; 9 don't support the necessary CSS properties. Thus, there are no slide transition animations when using these browsers. We have intentionally decided not to include jQuery-based fallbacks for the transitions.</p>
1755 </div>
1756
1757     <h3>Optional captions</h3>
1758     <p>Add captions to your slides easily with the <code>.carousel-caption</code> element within any <code>.item</code>. Place just about any optional HTML within there and it will be automatically aligned and formatted.</p>
1759     <div class="bs-example">
1760       <div id="carousel-example-captions" class="carousel slide" data-ride="carousel">
1761         <ol class="carousel-indicators">
1762           <li data-target="#carousel-example-captions" data-slide-to="0" class="active"></li>
1763           <li data-target="#carousel-example-captions" data-slide-to="1"></li>
1764           <li data-target="#carousel-example-captions" data-slide-to="2"></li>
1765         </ol>
1766         <div class="carousel-inner">
1767           <div class="item active">
1768             <img data-src="holder.js/900x500/auto/#777:#777" alt="First slide image">
1769             <div class="carousel-caption">
1770               <h3>First slide label</h3>
1771               <p>Nulla vitae elit libero, a pharetra augue mollis interdum.</p>
1772             </div>
1773           </div>
1774           <div class="item">
1775             <img data-src="holder.js/900x500/auto/#666:#666" alt="Second slide image">
1776             <div class="carousel-caption">
1777               <h3>Second slide label</h3>
1778               <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>
1779             </div>
1780           </div>
1781           <div class="item">
1782             <img data-src="holder.js/900x500/auto/#555:#5555" alt="Third slide image">
1783             <div class="carousel-caption">
1784               <h3>Third slide label</h3>
1785               <p>Praesent commodo cursus magna, vel scelerisque nisl consectetur.</p>
1786             </div>
1787           </div>
1788         </div>
1789         <a class="left carousel-control" href="#carousel-example-captions" data-slide="prev">
1790           <span class="glyphicon glyphicon-chevron-left"></span>
1791         </a>
1792         <a class="right carousel-control" href="#carousel-example-captions" data-slide="next">
1793           <span class="glyphicon glyphicon-chevron-right"></span>
1794         </a>
1795       </div>
1796     </div><!-- /example -->
1797 {% highlight html %}
1798 <div class="item active">
1799   <img src="..." alt="...">
1800   <div class="carousel-caption">
1801     <h3>...</h3>
1802     <p>...</p>
1803   </div>
1804 </div>
1805 {% endhighlight %}
1806
1807 <div class="bs-callout bs-callout-danger">
1808   <h4>Accessibility issue</h4>
1809   <p>The carousel component is generally not compliant with accessibility standards. If you need to be compliant, please consider other options for presenting your content.</p>
1810 </div>
1811
1812     <h2 id="carousel-usage">Usage</h2>
1813
1814     <h3>Via data attributes</h3>
1815     <p>Use data attributes to easily control the position of the carousel. <code>data-slide</code> accepts the keywords <code>prev</code> or <code>next</code>, which alters the slide position relative to its current position. Alternatively, use <code>data-slide-to</code> to pass a raw slide index to the carousel <code>data-slide-to="2"</code>, which shifts the slide position to a particular index beginning with <code>0</code>.</p>
1816     <p>The <code>data-ride="carousel"</code> attribute is used to mark a carousel as animating starting at page load.</p>
1817
1818     <h3>Via JavaScript</h3>
1819     <p>Call carousel manually with:</p>
1820 {% highlight js %}
1821 $('.carousel').carousel()
1822 {% endhighlight %}
1823
1824     <h3>Options</h3>
1825     <p>Options can be passed via data attributes or JavaScript. For data attributes, append the option name to <code>data-</code>, as in <code>data-interval=""</code>.</p>
1826     <div class="table-responsive">
1827       <table class="table table-bordered table-striped">
1828         <thead>
1829          <tr>
1830            <th style="width: 100px;">Name</th>
1831            <th style="width: 50px;">type</th>
1832            <th style="width: 50px;">default</th>
1833            <th>description</th>
1834          </tr>
1835         </thead>
1836         <tbody>
1837          <tr>
1838            <td>interval</td>
1839            <td>number</td>
1840            <td>5000</td>
1841            <td>The amount of time to delay between automatically cycling an item. If false, carousel will not automatically cycle.</td>
1842          </tr>
1843          <tr>
1844            <td>pause</td>
1845            <td>string</td>
1846            <td>"hover"</td>
1847            <td>Pauses the cycling of the carousel on mouseenter and resumes the cycling of the carousel on mouseleave.</td>
1848          </tr>
1849          <tr>
1850            <td>wrap</td>
1851            <td>boolean</td>
1852            <td>true</td>
1853            <td>Whether the carousel should cycle continuously or have hard stops.</td>
1854          </tr>
1855         </tbody>
1856       </table>
1857     </div><!-- /.table-responsive -->
1858
1859     <h3>Methods</h3>
1860
1861     <h4>.carousel(options)</h4>
1862     <p>Initializes the carousel with an optional options <code>object</code> and starts cycling through items.</p>
1863 {% highlight js %}
1864 $('.carousel').carousel({
1865   interval: 2000
1866 })
1867 {% endhighlight %}
1868
1869     <h4>.carousel('cycle')</h4>
1870     <p>Cycles through the carousel items from left to right.</p>
1871
1872     <h4>.carousel('pause')</h4>
1873     <p>Stops the carousel from cycling through items.</p>
1874
1875
1876     <h4>.carousel(number)</h4>
1877     <p>Cycles the carousel to a particular frame (0 based, similar to an array).</p>
1878
1879     <h4>.carousel('prev')</h4>
1880     <p>Cycles to the previous item.</p>
1881
1882     <h4>.carousel('next')</h4>
1883     <p>Cycles to the next item.</p>
1884
1885     <h3>Events</h3>
1886     <p>Bootstrap's carousel class exposes two events for hooking into carousel functionality.</p>
1887     <div class="table-responsive">
1888       <table class="table table-bordered table-striped">
1889         <thead>
1890          <tr>
1891            <th style="width: 150px;">Event Type</th>
1892            <th>Description</th>
1893          </tr>
1894         </thead>
1895         <tbody>
1896          <tr>
1897            <td>slide.bs.carousel</td>
1898            <td>This event fires immediately when the <code>slide</code> instance method is invoked.</td>
1899          </tr>
1900          <tr>
1901            <td>slid.bs.carousel</td>
1902            <td>This event is fired when the carousel has completed its slide transition.</td>
1903          </tr>
1904         </tbody>
1905       </table>
1906     </div><!-- /.table-responsive -->
1907 {% highlight js %}
1908 $('#myCarousel').on('slide.bs.carousel', function () {
1909   // do something…
1910 })
1911 {% endhighlight %}
1912   </div>
1913
1914
1915
1916   <!-- Affix
1917   ================================================== -->
1918   <div class="bs-docs-section">
1919     <div class="page-header">
1920       <h1 id="affix">Affix <small>affix.js</small></h1>
1921     </div>
1922
1923     <h2 id="affix-examples">Example</h2>
1924     <p>The subnavigation on the left is a live demo of the affix plugin.</p>
1925
1926     <hr class="bs-docs-separator">
1927
1928     <h2 id="affix-usage">Usage</h2>
1929
1930     <h3>Via data attributes</h3>
1931     <p>To easily add affix behavior to any element, just add <code>data-spy="affix"</code> to the element you want to spy on. Then use offsets to define when to toggle the pinning of an element on and off.</p>
1932
1933 {% highlight html %}
1934 <div data-spy="affix" data-offset-top="200">...</div>
1935 {% endhighlight %}
1936
1937     <div class="bs-callout bs-callout-warning">
1938       <h4>Requires independent styling ;)</h4>
1939       <p>
1940         Affix toggles between three states/classes: <code>.affix</code>, <code>.affix-top</code>, and <code>.affix-bottom</code>. You must provide the styles for these classes yourself (independent of this plugin).
1941         The <code>.affix-top</code> class should be in the regular flow of the document. The <code>.affix</code> class should be <code>position: fixed</code>. And <code>.affix-bottom</code> should be <code>position: absolute</code>. Note: <code>.affix-bottom</code> is special in that the plugin will place the element with JS relative to the <code>offset: { bottom: number }</code> option you've provided.
1942       </p>
1943     </div>
1944
1945     <h3>Via JavaScript</h3>
1946     <p>Call the affix plugin via JavaScript:</p>
1947 {% highlight js %}
1948   $('#myAffix').affix({
1949     offset: {
1950       top: 100
1951     , bottom: function () {
1952         return (this.bottom = $('.bs-footer').outerHeight(true))
1953       }
1954     }
1955   })
1956 {% endhighlight %}
1957
1958
1959     <h3>Options</h3>
1960     <p>Options can be passed via data attributes or JavaScript. For data attributes, append the option name to <code>data-</code>, as in <code>data-offset-top="200"</code>.</p>
1961
1962     <div class="table-responsive">
1963       <table class="table table-bordered table-striped">
1964         <thead>
1965          <tr>
1966            <th style="width: 100px;">Name</th>
1967            <th style="width: 100px;">type</th>
1968            <th style="width: 50px;">default</th>
1969            <th>description</th>
1970          </tr>
1971         </thead>
1972         <tbody>
1973          <tr>
1974            <td>offset</td>
1975            <td>number | function | object</td>
1976            <td>10</td>
1977            <td>Pixels to offset from screen when calculating position of scroll. If a single number is provided, the offset will be applied in both top and bottom directions. To provide a unique, bottom and top offset just provide an object <code>offset: { top: 10 }</code> or <code>offset: { top: 10, bottom: 5 }</code>. Use a function when you need to dynamically calculate an offset.</td>
1978          </tr>
1979         </tbody>
1980       </table>
1981     </div><!-- /.table-responsive -->
1982
1983   </div>