javascript.html 100 KB
Newer Older
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
         </tr>
         <tr>
           <td>trigger</td>
           <td>string</td>
           <td>'hover focus'</td>
           <td>how tooltip is triggered - click | hover | focus | manual. You may pass multiple triggers; separate them with a space.</td>
         </tr>
         <tr>
           <td>delay</td>
           <td>number | object</td>
           <td>0</td>
           <td>
            <p>delay showing and hiding the tooltip (ms) - does not apply to manual trigger type</p>
            <p>If a number is supplied, delay is applied to both hide/show</p>
            <p>Object structure is: <code>delay: { show: 500, hide: 100 }</code></p>
           </td>
         </tr>
         <tr>
           <td>container</td>
           <td>string | false</td>
           <td>false</td>
           <td>
            <p>Appends the tooltip to a specific element. Example: <code>container: 'body'</code></p>
           </td>
         </tr>
        </tbody>
      </table>
1028
    </div><!-- /.table-responsive -->
1029
1030
1031
1032
    <div class="bs-callout bs-callout-info">
      <h4>Data attributes for individual tooltips</h4>
      <p>Options for individual tooltips can alternatively be specified through the use of data attributes, as explained above.</p>
    </div>
Mark Otto's avatar
Mark Otto committed
1033

1034
1035
1036
1037
    <h3>Methods</h3>

    <h4>$().tooltip(options)</h4>
    <p>Attaches a tooltip handler to an element collection.</p>
Mark Otto's avatar
Mark Otto committed
1038

1039
1040
1041
    <h4>.tooltip('show')</h4>
    <p>Reveals an element's tooltip.</p>
    {% highlight js %}$('#element').tooltip('show'){% endhighlight %}
Mark Otto's avatar
Mark Otto committed
1042

1043
1044
1045
    <h4>.tooltip('hide')</h4>
    <p>Hides an element's tooltip.</p>
    {% highlight js %}$('#element').tooltip('hide'){% endhighlight %}
Mark Otto's avatar
Mark Otto committed
1046

1047
1048
1049
1050
1051
1052
1053
    <h4>.tooltip('toggle')</h4>
    <p>Toggles an element's tooltip.</p>
    {% highlight js %}$('#element').tooltip('toggle'){% endhighlight %}

    <h4>.tooltip('destroy')</h4>
    <p>Hides and destroys an element's tooltip.</p>
    {% highlight js %}$('#element').tooltip('destroy'){% endhighlight %}
Mark Otto's avatar
Mark Otto committed
1054

1055
    <h3>Events</h3>
1056
    <div class="table-responsive">
1057
1058
1059
1060
1061
1062
1063
1064
1065
      <table class="table table-bordered table-striped">
        <thead>
         <tr>
           <th style="width: 150px;">Event Type</th>
           <th>Description</th>
         </tr>
        </thead>
        <tbody>
         <tr>
Jacob Thornton's avatar
Jacob Thornton committed
1066
           <td>show.bs.tooltip</td>
1067
1068
1069
           <td>This event fires immediately when the <code>show</code> instance method is called.</td>
         </tr>
         <tr>
Jacob Thornton's avatar
Jacob Thornton committed
1070
           <td>shown.bs.tooltip</td>
1071
1072
1073
           <td>This event is fired when the tooltip has been made visible to the user (will wait for CSS transitions to complete).</td>
         </tr>
         <tr>
Jacob Thornton's avatar
Jacob Thornton committed
1074
           <td>hide.bs.tooltip</td>
1075
1076
1077
           <td>This event is fired immediately when the <code>hide</code> instance method has been called.</td>
         </tr>
         <tr>
Jacob Thornton's avatar
Jacob Thornton committed
1078
           <td>hidden.bs.tooltip</td>
1079
1080
1081
1082
           <td>This event is fired when the tooltip has finished being hidden from the user (will wait for CSS transitions to complete).</td>
         </tr>
        </tbody>
      </table>
1083
    </div><!-- /.table-responsive -->
1084
1085
{% highlight js %}
$('#myTooltip').on('hidden.bs.tooltip', function () {
ggam's avatar
ggam committed
1086
  // do something…
1087
1088
})
{% endhighlight %}
1089
  </div>
Mark Otto's avatar
Mark Otto committed
1090

1091
1092
1093
1094
1095
1096
1097
1098
  <!-- Popovers
  ================================================== -->
  <div class="bs-docs-section">
    <div class="page-header">
      <h1 id="popovers">Popovers <small>popover.js</small></h1>
    </div>

    <h2 id="popovers-examples">Examples</h2>
fat's avatar
fat committed
1099
    <p>Add small overlays of content, like those on the iPad, to any element for housing secondary information.</p>
Mark Otto's avatar
Mark Otto committed
1100

1101
1102
1103
1104
    <div class="bs-callout bs-callout-danger">
      <h4>Plugin dependency</h4>
      <p>Popovers require the <a href="#tooltips">tooltip plugin</a> to be included in your version of Bootstrap.</p>
    </div>
1105
1106
    <div class="bs-callout bs-callout-danger">
      <h4>Opt-in functionality</h4>
Julian Thilo's avatar
Julian Thilo committed
1107
      <p>For performance reasons, the Tooltip and Popover data-apis are opt-in, meaning <strong>you must initialize them yourself</strong>.</p>
1108
    </div>
1109
1110
1111
1112
    <div class="bs-callout bs-callout-info">
      <h4>Popovers in button groups and input groups require special setting</h4>
      <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>
    </div>
1113
1114
    <div class="bs-callout bs-callout-info">
      <h4>Popovers on disabled elements require wrapper elements</h4>
1115
      <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>
1116
    </div>
Mark Otto's avatar
Mark Otto committed
1117

1118
1119
1120
1121
1122
1123
1124
1125
    <h3>Static popover</h3>
    <p>Four options are available: top, right, bottom, and left aligned.</p>
    <div class="bs-example bs-example-popover">
      <div class="popover top">
        <div class="arrow"></div>
        <h3 class="popover-title">Popover top</h3>
        <div class="popover-content">
          <p>Sed posuere consectetur est at lobortis. Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis vestibulum.</p>
Mark Otto's avatar
Mark Otto committed
1126
        </div>
1127
      </div>
Mark Otto's avatar
Mark Otto committed
1128

1129
1130
1131
1132
1133
1134
1135
      <div class="popover right">
        <div class="arrow"></div>
        <h3 class="popover-title">Popover right</h3>
        <div class="popover-content">
          <p>Sed posuere consectetur est at lobortis. Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis vestibulum.</p>
        </div>
      </div>
Mark Otto's avatar
Mark Otto committed
1136

1137
1138
1139
      <div class="popover bottom">
        <div class="arrow"></div>
        <h3 class="popover-title">Popover bottom</h3>
1140

1141
1142
        <div class="popover-content">
          <p>Sed posuere consectetur est at lobortis. Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis vestibulum.</p>
Mark Otto's avatar
Mark Otto committed
1143
        </div>
1144
1145
1146
1147
1148
1149
1150
      </div>

      <div class="popover left">
        <div class="arrow"></div>
        <h3 class="popover-title">Popover left</h3>
        <div class="popover-content">
          <p>Sed posuere consectetur est at lobortis. Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis vestibulum.</p>
Chris Rebert's avatar
Chris Rebert committed
1151
        </div>
1152
      </div>
Mark Otto's avatar
Mark Otto committed
1153

1154
1155
      <div class="clearfix"></div>
    </div>
Mark Otto's avatar
Mark Otto committed
1156

1157
1158
    <h3>Live demo</h3>
    <div class="bs-example" style="padding-bottom: 24px;">
1159
      <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>
1160
    </div>
Mark Otto's avatar
Mark Otto committed
1161

1162
1163
    <h4>Four directions</h4>
    <div class="bs-example tooltip-demo">
1164
      <div class="bs-example-tooltips">
1165
        <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.">
1166
1167
          Popover on left
        </button>
1168
        <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.">
1169
1170
          Popover on top
        </button>
1171
        <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.">
1172
1173
          Popover on bottom
        </button>
1174
        <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.">
1175
          Popover on right
1176
1177
        </button>
      </div>
1178
    </div><!-- /example -->
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
{% highlight html %}
<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.">
  Popover on left
</button>

<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.">
  Popover on top
</button>

<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.">
  Popover on bottom
</button>

<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.">
  Popover on right
</button>
{% endhighlight %}

    <div class="bs-callout bs-callout-warning">
      <h4>Multiple-line links</h4>
      <p>Sometimes you want to add a tooltip to a hyperlink that wraps multiple lines. The default behavior of the tooltip plugin is to center it horizontally and vertically. Add <code>white-space: nowrap;</code> to your anchors to avoid this.</p>
    </div>
Mark Otto's avatar
Mark Otto committed
1202
1203


1204
1205
1206
    <h2 id="popovers-usage">Usage</h2>
    <p>Enable popovers via JavaScript:</p>
    {% highlight js %}$('#example').popover(options){% endhighlight %}
Mark Otto's avatar
Mark Otto committed
1207

1208
1209
    <h3>Options</h3>
    <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>
1210
    <div class="table-responsive">
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
      <table class="table table-bordered table-striped">
        <thead>
          <tr>
            <th style="width: 100px;">Name</th>
            <th style="width: 100px;">type</th>
            <th style="width: 50px;">default</th>
            <th>description</th>
          </tr>
        </thead>
        <tbody>
          <tr>
            <td>animation</td>
            <td>boolean</td>
            <td>true</td>
kostyatretyak's avatar
kostyatretyak committed
1225
            <td>apply a CSS fade transition to the popover</td>
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
          </tr>
          <tr>
            <td>html</td>
            <td>boolean</td>
            <td>false</td>
            <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>
          </tr>
          <tr>
            <td>placement</td>
            <td>string | function</td>
            <td>'right'</td>
1237
            <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>
1238
1239
1240
1241
1242
          </tr>
          <tr>
            <td>selector</td>
            <td>string</td>
            <td>false</td>
kostyatretyak's avatar
kostyatretyak committed
1243
            <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>
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
          </tr>
          <tr>
            <td>trigger</td>
            <td>string</td>
            <td>'click'</td>
            <td>how popover is triggered - click | hover | focus | manual</td>
          </tr>
          <tr>
            <td>title</td>
            <td>string | function</td>
            <td>''</td>
            <td>default title value if <code>title</code> attribute isn't present</td>
          </tr>
          <tr>
            <td>content</td>
            <td>string | function</td>
            <td>''</td>
            <td>default content value if <code>data-content</code> attribute isn't present</td>
          </tr>
          <tr>
            <td>delay</td>
            <td>number | object</td>
            <td>0</td>
            <td>
             <p>delay showing and hiding the popover (ms) - does not apply to manual trigger type</p>
             <p>If a number is supplied, delay is applied to both hide/show</p>
             <p>Object structure is: <code>delay: { show: 500, hide: 100 }</code></p>
            </td>
          </tr>
          <tr>
            <td>container</td>
            <td>string | false</td>
            <td>false</td>
            <td>
Chris Rebert's avatar
Chris Rebert committed
1278
             <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>
1279
1280
1281
1282
            </td>
          </tr>
        </tbody>
      </table>
1283
    </div><!-- /.table-responsive -->
1284
1285
1286
1287
    <div class="bs-callout bs-callout-info">
      <h4>Data attributes for individual popovers</h4>
      <p>Options for individual popovers can alternatively be specified through the use of data attributes, as explained above.</p>
    </div>
Mark Otto's avatar
Mark Otto committed
1288

1289
1290
1291
    <h3>Methods</h3>
    <h4>$().popover(options)</h4>
    <p>Initializes popovers for an element collection.</p>
Mark Otto's avatar
Mark Otto committed
1292

1293
1294
1295
    <h4>.popover('show')</h4>
    <p>Reveals an elements popover.</p>
    {% highlight js %}$('#element').popover('show'){% endhighlight %}
Mark Otto's avatar
Mark Otto committed
1296

1297
1298
1299
    <h4>.popover('hide')</h4>
    <p>Hides an elements popover.</p>
    {% highlight js %}$('#element').popover('hide'){% endhighlight %}
Mark Otto's avatar
Mark Otto committed
1300

1301
1302
1303
    <h4>.popover('toggle')</h4>
    <p>Toggles an elements popover.</p>
    {% highlight js %}$('#element').popover('toggle'){% endhighlight %}
Mark Otto's avatar
Mark Otto committed
1304

1305
1306
1307
    <h4>.popover('destroy')</h4>
    <p>Hides and destroys an element's popover.</p>
    {% highlight js %}$('#element').popover('destroy'){% endhighlight %}
1308
    <h3>Events</h3>
1309
    <div class="table-responsive">
1310
1311
1312
1313
1314
1315
1316
1317
1318
      <table class="table table-bordered table-striped">
        <thead>
         <tr>
           <th style="width: 150px;">Event Type</th>
           <th>Description</th>
         </tr>
        </thead>
        <tbody>
         <tr>
Jacob Thornton's avatar
Jacob Thornton committed
1319
           <td>show.bs.popover</td>
1320
1321
1322
           <td>This event fires immediately when the <code>show</code> instance method is called.</td>
         </tr>
         <tr>
Jacob Thornton's avatar
Jacob Thornton committed
1323
           <td>shown.bs.popover</td>
1324
1325
1326
           <td>This event is fired when the popover has been made visible to the user (will wait for CSS transitions to complete).</td>
         </tr>
         <tr>
Jacob Thornton's avatar
Jacob Thornton committed
1327
           <td>hide.bs.popover</td>
1328
1329
1330
           <td>This event is fired immediately when the <code>hide</code> instance method has been called.</td>
         </tr>
         <tr>
Jacob Thornton's avatar
Jacob Thornton committed
1331
           <td>hidden.bs.popover</td>
1332
1333
1334
1335
           <td>This event is fired when the popover has finished being hidden from the user (will wait for CSS transitions to complete).</td>
         </tr>
        </tbody>
      </table>
1336
    </div><!-- /.table-responsive -->
1337
1338
1339
1340
1341
{% highlight js %}
$('#myPopover').on('hidden.bs.popover', function () {
  // do something…
})
{% endhighlight %}
1342
  </div>
Mark Otto's avatar
Mark Otto committed
1343

1344
1345
1346
1347
1348
1349
  <!-- Alert
  ================================================== -->
  <div class="bs-docs-section">
    <div class="page-header">
      <h1 id="alerts">Alert messages <small>alert.js</small></h1>
    </div>
Mark Otto's avatar
Mark Otto committed
1350
1351


1352
1353
1354
    <h2 id="alerts-examples">Example alerts</h2>
    <p>Add dismiss functionality to all alert messages with this plugin.</p>
    <div class="bs-example">
1355
      <div class="alert alert-warning fade in">
1356
        <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
1357
1358
1359
        <strong>Holy guacamole!</strong> Best check yo self, you're not looking too good.
      </div>
    </div><!-- /example -->
Mark Otto's avatar
Mark Otto committed
1360

1361
    <div class="bs-example">
1362
      <div class="alert alert-danger fade in">
1363
        <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
1364
1365
1366
        <h4>Oh snap! You got an error!</h4>
        <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>
        <p>
Mark Otto's avatar
Mark Otto committed
1367
1368
          <button type="button" class="btn btn-danger">Take this action</button>
          <button type="button" class="btn btn-default">Or do this</button>
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
        </p>
      </div>
    </div><!-- /example -->


    <h2 id="alerts-usage">Usage</h2>
    <p>Enable dismissal of an alert via JavaScript:</p>
    {% highlight js %}$(".alert").alert(){% endhighlight %}

    <h3>Markup</h3>
    <p>Just add <code>data-dismiss="alert"</code> to your close button to automatically give an alert close functionality.</p>
1380
    {% highlight html %}<a class="close" data-dismiss="alert" href="#" aria-hidden="true">&times;</a>{% endhighlight %}
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393

    <h3>Methods</h3>

    <h4>$().alert()</h4>
    <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>

    <h4>.alert('close')</h4>
    <p>Closes an alert.</p>
    {% highlight js %}$(".alert").alert('close'){% endhighlight %}


    <h3>Events</h3>
    <p>Bootstrap's alert class exposes a few events for hooking into alert functionality.</p>
1394
    <div class="table-responsive">
1395
1396
1397
1398
1399
1400
1401
1402
1403
      <table class="table table-bordered table-striped">
        <thead>
          <tr>
            <th style="width: 150px;">Event Type</th>
            <th>Description</th>
          </tr>
        </thead>
        <tbody>
          <tr>
Jacob Thornton's avatar
Jacob Thornton committed
1404
            <td>close.bs.alert</td>
1405
1406
1407
            <td>This event fires immediately when the <code>close</code> instance method is called.</td>
          </tr>
          <tr>
Jacob Thornton's avatar
Jacob Thornton committed
1408
            <td>closed.bs.alert</td>
1409
1410
1411
1412
            <td>This event is fired when the alert has been closed (will wait for CSS transitions to complete).</td>
          </tr>
        </tbody>
      </table>
1413
    </div><!-- /.table-responsive -->
Mark Otto's avatar
Mark Otto committed
1414
{% highlight js %}
fat's avatar
fat committed
1415
$('#my-alert').bind('closed.bs.alert', function () {
Mark Otto's avatar
Mark Otto committed
1416
1417
1418
  // do something…
})
{% endhighlight %}
1419
  </div>
Mark Otto's avatar
Mark Otto committed
1420
1421
1422



1423
1424
1425
1426
1427
1428
  <!-- Buttons
  ================================================== -->
  <div class="bs-docs-section">
    <div class="page-header">
      <h1 id="buttons">Buttons <small>button.js</small></h1>
    </div>
Mark Otto's avatar
Mark Otto committed
1429

1430
1431
    <h2 id="buttons-examples">Example uses</h2>
    <p>Do more with buttons. Control button states or create groups of buttons for more components like toolbars.</p>
Mark Otto's avatar
Mark Otto committed
1432

1433
1434
1435
    <h4>Stateful</h4>
    <p>Add <code>data-loading-text="Loading..."</code> to use a loading state on a button.</p>
    <div class="bs-example" style="padding-bottom: 24px;">
1436
      <button type="button" id="loading-example-btn" data-loading-text="Loading..." class="btn btn-primary">
1437
1438
1439
        Loading state
      </button>
    </div><!-- /example -->
Mark Otto's avatar
Mark Otto committed
1440
{% highlight html %}
1441
<button type="button" id="loading-example-btn" data-loading-text="Loading..." class="btn btn-primary">
Mark Otto's avatar
Mark Otto committed
1442
1443
  Loading state
</button>
1444
1445
1446
1447
1448
1449
1450
1451
1452
<script>
  $('#loading-example-btn').click(function () {
    var btn = $(this);
    btn.button('loading');
    $.ajax(...).always(function () {
      btn.button('reset');
    });
  });
</script>
Mark Otto's avatar
Mark Otto committed
1453
1454
{% endhighlight %}

1455
1456
1457
1458
1459
    <h4>Single toggle</h4>
    <p>Add <code>data-toggle="button"</code> to activate toggling on a single button.</p>
    <div class="bs-example" style="padding-bottom: 24px;">
      <button type="button" class="btn btn-primary" data-toggle="button">Single toggle</button>
    </div><!-- /example -->
Mark Otto's avatar
Mark Otto committed
1460
1461
1462
1463
{% highlight html %}
<button type="button" class="btn btn-primary" data-toggle="button">Single toggle</button>
{% endhighlight %}

1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
    <h4>Checkbox</h4>
    <p>Add <code>data-toggle="buttons"</code> to a group of checkboxes for checkbox style toggling on btn-group.</p>
    <div class="bs-example" style="padding-bottom: 24px;">
      <div class="btn-group" data-toggle="buttons">
        <label class="btn btn-primary">
          <input type="checkbox"> Option 1
        </label>
        <label class="btn btn-primary">
          <input type="checkbox"> Option 2
        </label>
        <label class="btn btn-primary">
          <input type="checkbox"> Option 3
        </label>
      </div>
    </div><!-- /example -->
Mark Otto's avatar
Mark Otto committed
1479
{% highlight html %}
1480
<div class="btn-group" data-toggle="buttons">
Mark Otto's avatar
Mark Otto committed
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
  <label class="btn btn-primary">
    <input type="checkbox"> Option 1
  </label>
  <label class="btn btn-primary">
    <input type="checkbox"> Option 2
  </label>
  <label class="btn btn-primary">
    <input type="checkbox"> Option 3
  </label>
</div>
{% endhighlight %}

1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
    <h4>Radio</h4>
    <p>Add <code>data-toggle="buttons"</code> to a group of radio inputs for radio style toggling on btn-group.</p>
    <div class="bs-example" style="padding-bottom: 24px;">
      <div class="btn-group" data-toggle="buttons">
        <label class="btn btn-primary">
          <input type="radio" name="options" id="option1"> Option 1
        </label>
        <label class="btn btn-primary">
          <input type="radio" name="options" id="option2"> Option 2
        </label>
        <label class="btn btn-primary">
          <input type="radio" name="options" id="option3"> Option 3
        </label>
      </div>
    </div><!-- /example -->
Mark Otto's avatar
Mark Otto committed
1508
{% highlight html %}
1509
<div class="btn-group" data-toggle="buttons">
Mark Otto's avatar
Mark Otto committed
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
  <label class="btn btn-primary">
    <input type="radio" name="options" id="option1"> Option 1
  </label>
  <label class="btn btn-primary">
    <input type="radio" name="options" id="option2"> Option 2
  </label>
  <label class="btn btn-primary">
    <input type="radio" name="options" id="option3"> Option 3
  </label>
</div>
{% endhighlight %}


1523
1524
    <h2 id="buttons-usage">Usage</h2>
    <p>Enable buttons via JavaScript:</p>
Mark Otto's avatar
Mark Otto committed
1525
{% highlight js %}
1526
$('.btn').button()
Mark Otto's avatar
Mark Otto committed
1527
1528
{% endhighlight %}

1529
1530
    <h3>Markup</h3>
    <p>Data attributes are integral to the button plugin. Check out the example code below for the various markup types.</p>
Mark Otto's avatar
Mark Otto committed
1531

1532
1533
    <h3>Options</h3>
    <p><em>None</em></p>
Mark Otto's avatar
Mark Otto committed
1534

1535
    <h3>Methods</h3>
Mark Otto's avatar
Mark Otto committed
1536

1537
1538
1539
1540
1541
1542
    <h4>$().button('toggle')</h4>
    <p>Toggles push state. Gives the button the appearance that it has been activated.</p>
    <div class="bs-callout bs-callout-info">
      <h4>Auto toggling</h4>
      <p>You can enable auto toggling of a button by using the <code>data-toggle</code> attribute.</p>
    </div>
Mark Otto's avatar
Mark Otto committed
1543
{% highlight html %}
1544
<button type="button" class="btn btn-primary" data-toggle="button">...</button>
Mark Otto's avatar
Mark Otto committed
1545
1546
{% endhighlight %}

1547
1548
1549
    <h4>$().button('loading')</h4>
    <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>.
    </p>
Mark Otto's avatar
Mark Otto committed
1550
{% highlight html %}
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
<button id="loading-example-btn" type="button" class="btn btn-primary" data-loading-text="loading stuff...">...</button>
<script>
  $('#loading-example-btn').click(function () {
    var btn = $(this);
    btn.button('loading');
    $.ajax(...).always(function () {
      btn.button('reset');
    });
  });
</script>
Mark Otto's avatar
Mark Otto committed
1561
1562
{% endhighlight %}

1563
1564
1565
1566
    <div class="bs-callout bs-callout-danger">
      <h4>Cross-browser compatibility</h4>
      <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>
    </div>
Mark Otto's avatar
Mark Otto committed
1567

1568
1569
    <h4>$().button('reset')</h4>
    <p>Resets button state - swaps text to original text.</p>
Mark Otto's avatar
Mark Otto committed
1570

1571
1572
    <h4>$().button(string)</h4>
    <p>Resets button state - swaps text to any data defined text state.</p>
Mark Otto's avatar
Mark Otto committed
1573
{% highlight html %}
1574
<button type="button" class="btn btn-primary" data-complete-text="finished!" >...</button>
Mark Otto's avatar
Mark Otto committed
1575
1576
1577
1578
<script>
  $('.btn').button('complete')
</script>
{% endhighlight %}
1579
  </div>
Mark Otto's avatar
Mark Otto committed
1580
1581
1582



1583
1584
1585
1586
1587
1588
  <!-- Collapse
  ================================================== -->
  <div class="bs-docs-section">
    <div class="page-header">
      <h1 id="collapse">Collapse <small>collapse.js</small></h1>
    </div>
Mark Otto's avatar
Mark Otto committed
1589

1590
1591
    <h3>About</h3>
    <p>Get base styles and flexible support for collapsible components like accordions and navigation.</p>
Mark Otto's avatar
Mark Otto committed
1592

1593
1594
1595
1596
1597
1598
    <div class="bs-callout bs-callout-danger">
      <h4>Plugin dependency</h4>
      <p>Collapse requires the <a href="#transitions">transitions plugin</a> to be included in your version of Bootstrap.</p>
    </div>

    <h2 id="collapse-examples">Example accordion</h2>
Mark Otto's avatar
copy    
Mark Otto committed
1599
    <p>Using the collapse plugin, we built a simple accordion by extending the panel component.</p>
Mark Otto's avatar
Mark Otto committed
1600

1601
    <div class="bs-example">
Mark Otto's avatar
Mark Otto committed
1602
      <div class="panel-group" id="accordion">
Mark Otto's avatar
Mark Otto committed
1603
        <div class="panel panel-default">
Mark Otto's avatar
Mark Otto committed
1604
          <div class="panel-heading">
1605
            <h4 class="panel-title">
1606
              <a data-toggle="collapse" data-parent="#accordion" href="#collapseOne">
Mark Otto's avatar
Mark Otto committed
1607
1608
                Collapsible Group Item #1
              </a>
1609
            </h4>
1610
          </div>
Mark Otto's avatar
Mark Otto committed
1611
1612
          <div id="collapseOne" class="panel-collapse collapse in">
            <div class="panel-body">
1613
1614
1615
1616
              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.
            </div>
          </div>
        </div>
Mark Otto's avatar
Mark Otto committed
1617
        <div class="panel panel-default">
Mark Otto's avatar
Mark Otto committed
1618
          <div class="panel-heading">
1619
            <h4 class="panel-title">
1620
              <a data-toggle="collapse" data-parent="#accordion" href="#collapseTwo">
Mark Otto's avatar
Mark Otto committed
1621
1622
                Collapsible Group Item #2
              </a>
1623
            </h4>
1624
          </div>
Mark Otto's avatar
Mark Otto committed
1625
1626
          <div id="collapseTwo" class="panel-collapse collapse">
            <div class="panel-body">
1627
1628
1629
1630
              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.
            </div>
          </div>
        </div>
Mark Otto's avatar
Mark Otto committed
1631
        <div class="panel panel-default">
Mark Otto's avatar
Mark Otto committed
1632
          <div class="panel-heading">
1633
            <h4 class="panel-title">
1634
              <a data-toggle="collapse" data-parent="#accordion" href="#collapseThree">
Mark Otto's avatar
Mark Otto committed
1635
1636
                Collapsible Group Item #3
              </a>
1637
            </h4>
1638
          </div>
Mark Otto's avatar
Mark Otto committed
1639
1640
          <div id="collapseThree" class="panel-collapse collapse">
            <div class="panel-body">
1641
1642
1643
1644
1645
1646
              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.
            </div>
          </div>
        </div>
      </div>
    </div><!-- /example -->
Mark Otto's avatar
Mark Otto committed
1647
{% highlight html %}
Mark Otto's avatar
Mark Otto committed
1648
<div class="panel-group" id="accordion">
Mark Otto's avatar
Mark Otto committed
1649
  <div class="panel panel-default">
Mark Otto's avatar
Mark Otto committed
1650
    <div class="panel-heading">
1651
      <h4 class="panel-title">
1652
        <a data-toggle="collapse" data-parent="#accordion" href="#collapseOne">
Mark Otto's avatar
Mark Otto committed
1653
1654
          Collapsible Group Item #1
        </a>
1655
      </h4>
Mark Otto's avatar
Mark Otto committed
1656
    </div>
Mark Otto's avatar
Mark Otto committed
1657
1658
1659
    <div id="collapseOne" class="panel-collapse collapse in">
      <div class="panel-body">
        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.
Mark Otto's avatar
Mark Otto committed
1660
1661
1662
      </div>
    </div>
  </div>
Mark Otto's avatar
Mark Otto committed
1663
  <div class="panel panel-default">
Mark Otto's avatar
Mark Otto committed
1664
    <div class="panel-heading">
1665
      <h4 class="panel-title">
1666
        <a data-toggle="collapse" data-parent="#accordion" href="#collapseTwo">
Mark Otto's avatar
Mark Otto committed
1667
1668
          Collapsible Group Item #2
        </a>
1669
      </h4>
Mark Otto's avatar
Mark Otto committed
1670
    </div>
Mark Otto's avatar
Mark Otto committed
1671
1672
1673
    <div id="collapseTwo" class="panel-collapse collapse">
      <div class="panel-body">
        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.
Mark Otto's avatar
Mark Otto committed
1674
1675
1676
      </div>
    </div>
  </div>
Mark Otto's avatar
Mark Otto committed
1677
  <div class="panel panel-default">
Mark Otto's avatar
Mark Otto committed
1678
    <div class="panel-heading">
1679
      <h4 class="panel-title">
1680
        <a data-toggle="collapse" data-parent="#accordion" href="#collapseThree">
Mark Otto's avatar
Mark Otto committed
1681
1682
          Collapsible Group Item #3
        </a>
1683
      </h4>
Mark Otto's avatar
Mark Otto committed
1684
    </div>
Mark Otto's avatar
Mark Otto committed
1685
1686
1687
    <div id="collapseThree" class="panel-collapse collapse">
      <div class="panel-body">
        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.
Mark Otto's avatar
Mark Otto committed
1688
1689
1690
1691
1692
1693
      </div>
    </div>
  </div>
</div>
{% endhighlight %}

1694
    <p>You can also use the plugin without the accordion markup. Make a button toggle the expanding and collapsing of another element.</p>
Mark Otto's avatar
Mark Otto committed
1695
1696
1697
1698
1699
1700
1701
1702
1703
{% highlight html %}
<button type="button" class="btn btn-danger" data-toggle="collapse" data-target="#demo">
  simple collapsible
</button>

<div id="demo" class="collapse in">...</div>
{% endhighlight %}


1704
    <h2 id="collapse-usage">Usage</h2>
1705
1706
1707
1708
1709
1710
1711
    <p>The collapse plugin utilizes a few classes to handle the heavy lifting:</p>
    <ul>
      <li><code>.collapse</code> hides the content</li>
      <li><code>.collapse.in</code> shows the content</li>
      <li><code>.collapsing</code> is added when the transition starts, and removed when it finishes</li>
    </ul>
    <p>These classes can be found in <code>component-animations.less</code>.</p>
Mark Otto's avatar
Mark Otto committed
1712

1713
1714
1715
    <h3>Via data attributes</h3>
    <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>
    <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>
Mark Otto's avatar
Mark Otto committed
1716

1717
1718
    <h3>Via JavaScript</h3>
    <p>Enable manually with:</p>
Mark Otto's avatar
Mark Otto committed
1719
{% highlight js %}
1720
$('.collapse').collapse()
Mark Otto's avatar
Mark Otto committed
1721
1722
{% endhighlight %}

1723
1724
    <h3>Options</h3>
    <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>
1725
    <div class="table-responsive">
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
      <table class="table table-bordered table-striped">
        <thead>
         <tr>
           <th style="width: 100px;">Name</th>
           <th style="width: 50px;">type</th>
           <th style="width: 50px;">default</th>
           <th>description</th>
         </tr>
        </thead>
        <tbody>
         <tr>
           <td>parent</td>
           <td>selector</td>
           <td>false</td>
fat's avatar
fat committed
1740
           <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>panel</code> class)</td>
1741
1742
1743
1744
1745
1746
1747
1748
1749
         </tr>
         <tr>
           <td>toggle</td>
           <td>boolean</td>
           <td>true</td>
           <td>Toggles the collapsible element on invocation</td>
         </tr>
        </tbody>
      </table>
1750
    </div><!-- /.table-responsive -->
1751
1752
1753
1754
1755

    <h3>Methods</h3>

    <h4>.collapse(options)</h4>
    <p>Activates your content as a collapsible element. Accepts an optional options <code>object</code>.
Mark Otto's avatar
Mark Otto committed
1756
1757
1758
1759
1760
1761
{% highlight js %}
$('#myCollapsible').collapse({
  toggle: false
})
{% endhighlight %}

1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
    <h4>.collapse('toggle')</h4>
    <p>Toggles a collapsible element to shown or hidden.</p>

    <h4>.collapse('show')</h4>
    <p>Shows a collapsible element.</p>

    <h4>.collapse('hide')</h4>
    <p>Hides a collapsible element.</p>

    <h3>Events</h3>
    <p>Bootstrap's collapse class exposes a few events for hooking into collapse functionality.</p>
1773
    <div class="table-responsive">
1774
1775
1776
1777
1778
1779
1780
1781
1782
      <table class="table table-bordered table-striped">
        <thead>
         <tr>
           <th style="width: 150px;">Event Type</th>
           <th>Description</th>
         </tr>
        </thead>
        <tbody>
         <tr>
Jacob Thornton's avatar
Jacob Thornton committed
1783
           <td>show.bs.collapse</td>
1784
1785
1786
           <td>This event fires immediately when the <code>show</code> instance method is called.</td>
         </tr>
         <tr>
Jacob Thornton's avatar
Jacob Thornton committed
1787
           <td>shown.bs.collapse</td>
1788
1789
1790
           <td>This event is fired when a collapse element has been made visible to the user (will wait for CSS transitions to complete).</td>
         </tr>
         <tr>
Jacob Thornton's avatar
Jacob Thornton committed
1791
           <td>hide.bs.collapse</td>
1792
1793
1794
1795
1796
           <td>
            This event is fired immediately when the <code>hide</code> method has been called.
           </td>
         </tr>
         <tr>
Jacob Thornton's avatar
Jacob Thornton committed
1797
           <td>hidden.bs.collapse</td>
1798
1799
1800
1801
           <td>This event is fired when a collapse element has been hidden from the user (will wait for CSS transitions to complete).</td>
         </tr>
        </tbody>
      </table>
1802
    </div><!-- /.table-responsive -->
Mark Otto's avatar
Mark Otto committed
1803
{% highlight js %}
fat's avatar
fat committed
1804
$('#myCollapsible').on('hidden.bs.collapse', function () {
Mark Otto's avatar
Mark Otto committed
1805
1806
1807
  // do something…
})
{% endhighlight %}
1808
  </div>
Mark Otto's avatar
Mark Otto committed
1809
1810
1811



1812
1813
1814
1815
1816
1817
  <!-- Carousel
  ================================================== -->
  <div class="bs-docs-section">
    <div class="page-header">
      <h1 id="carousel">Carousel <small>carousel.js</small></h1>
    </div>
Mark Otto's avatar
Mark Otto committed
1818

1819
1820
1821
    <h2 id="carousel-examples">Examples</h2>
    <p>The slideshow below shows a generic plugin and component for cycling through elements like a carousel.</p>
    <div class="bs-example">
1822
      <div id="carousel-example-generic" class="carousel slide" data-ride="carousel">
1823
1824
1825
1826
1827
1828
1829
        <ol class="carousel-indicators">
          <li data-target="#carousel-example-generic" data-slide-to="0" class="active"></li>
          <li data-target="#carousel-example-generic" data-slide-to="1"></li>
          <li data-target="#carousel-example-generic" data-slide-to="2"></li>
        </ol>
        <div class="carousel-inner">
          <div class="item active">
1830
            <img data-src="holder.js/900x500/auto/#777:#555/text:First slide" alt="First slide">
1831
1832
          </div>
          <div class="item">
1833
            <img data-src="holder.js/900x500/auto/#666:#444/text:Second slide" alt="Second slide">
1834
1835
          </div>
          <div class="item">
1836
            <img data-src="holder.js/900x500/auto/#555:#333/text:Third slide" alt="Third slide">
1837
1838
1839
          </div>
        </div>
        <a class="left carousel-control" href="#carousel-example-generic" data-slide="prev">
1840
          <span class="glyphicon glyphicon-chevron-left"></span>
1841
1842
        </a>
        <a class="right carousel-control" href="#carousel-example-generic" data-slide="next">
1843
          <span class="glyphicon glyphicon-chevron-right"></span>
1844
1845
1846
        </a>
      </div>
    </div><!-- /example -->
Mark Otto's avatar
Mark Otto committed
1847
{% highlight html %}
1848
<div id="carousel-example-generic" class="carousel slide" data-ride="carousel">
Mark Otto's avatar
Mark Otto committed
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
  <!-- Indicators -->
  <ol class="carousel-indicators">
    <li data-target="#carousel-example-generic" data-slide-to="0" class="active"></li>
    <li data-target="#carousel-example-generic" data-slide-to="1"></li>
    <li data-target="#carousel-example-generic" data-slide-to="2"></li>
  </ol>

  <!-- Wrapper for slides -->
  <div class="carousel-inner">
    <div class="item active">
Chris Rebert's avatar
Chris Rebert committed
1859
      <img src="..." alt="...">
Mark Otto's avatar
Mark Otto committed
1860
1861
1862
1863
1864
1865
1866
1867
1868
      <div class="carousel-caption">
        ...
      </div>
    </div>
    ...
  </div>

  <!-- Controls -->
  <a class="left carousel-control" href="#carousel-example-generic" data-slide="prev">
1869
    <span class="glyphicon glyphicon-chevron-left"></span>
Mark Otto's avatar
Mark Otto committed
1870
1871
  </a>
  <a class="right carousel-control" href="#carousel-example-generic" data-slide="next">
1872
    <span class="glyphicon glyphicon-chevron-right"></span>
Mark Otto's avatar
Mark Otto committed
1873
1874
1875
  </a>
</div>
{% endhighlight %}
1876
1877
1878
1879
<div class="bs-callout bs-callout-warning" id="callout-carousel-transitions">
  <h4>Transition animations not supported in Internet Explorer 8 &amp; 9</h4>
  <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>
</div>
Mark Otto's avatar
Mark Otto committed
1880

1881
1882
1883
    <h3>Optional captions</h3>
    <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>
    <div class="bs-example">
1884
      <div id="carousel-example-captions" class="carousel slide" data-ride="carousel">
1885
1886
1887
1888
1889
1890
1891
        <ol class="carousel-indicators">
          <li data-target="#carousel-example-captions" data-slide-to="0" class="active"></li>
          <li data-target="#carousel-example-captions" data-slide-to="1"></li>
          <li data-target="#carousel-example-captions" data-slide-to="2"></li>
        </ol>
        <div class="carousel-inner">
          <div class="item active">
1892
            <img data-src="holder.js/900x500/auto/#777:#777" alt="First slide image">
1893
1894
1895
1896
1897
1898
            <div class="carousel-caption">
              <h3>First slide label</h3>
              <p>Nulla vitae elit libero, a pharetra augue mollis interdum.</p>
            </div>
          </div>
          <div class="item">
1899
            <img data-src="holder.js/900x500/auto/#666:#666" alt="Second slide image">
1900
1901
1902
1903
1904
1905
            <div class="carousel-caption">
              <h3>Second slide label</h3>
              <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>
            </div>
          </div>
          <div class="item">
1906
            <img data-src="holder.js/900x500/auto/#555:#5555" alt="Third slide image">
1907
1908
1909
1910
1911
1912
1913
            <div class="carousel-caption">
              <h3>Third slide label</h3>
              <p>Praesent commodo cursus magna, vel scelerisque nisl consectetur.</p>
            </div>
          </div>
        </div>
        <a class="left carousel-control" href="#carousel-example-captions" data-slide="prev">
1914
          <span class="glyphicon glyphicon-chevron-left"></span>
1915
1916
        </a>
        <a class="right carousel-control" href="#carousel-example-captions" data-slide="next">
1917
          <span class="glyphicon glyphicon-chevron-right"></span>
1918
1919
1920
        </a>
      </div>
    </div><!-- /example -->
Mark Otto's avatar
Mark Otto committed
1921
1922
{% highlight html %}
<div class="item active">
1923
  <img src="..." alt="...">
Mark Otto's avatar
Mark Otto committed
1924
1925
1926
1927
1928
1929
1930
  <div class="carousel-caption">
    <h3>...</h3>
    <p>...</p>
  </div>
</div>
{% endhighlight %}

1931
1932
1933
1934
<div class="bs-callout bs-callout-danger">
  <h4>Accessibility issue</h4>
  <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>
</div>
Mark Otto's avatar
Mark Otto committed
1935

1936
    <h2 id="carousel-usage">Usage</h2>
Mark Otto's avatar
Mark Otto committed
1937

1938
1939
    <h3>Via data attributes</h3>
    <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>
1940
    <p>The <code>data-ride="carousel"</code> attribute is used to mark a carousel as animating starting at page load.</p>
Mark Otto's avatar
Mark Otto committed
1941

1942
1943
    <h3>Via JavaScript</h3>
    <p>Call carousel manually with:</p>
Mark Otto's avatar
Mark Otto committed
1944
1945
1946
1947
{% highlight js %}
$('.carousel').carousel()
{% endhighlight %}

1948
1949
    <h3>Options</h3>
    <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>
1950
    <div class="table-responsive">
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
      <table class="table table-bordered table-striped">
        <thead>
         <tr>
           <th style="width: 100px;">Name</th>
           <th style="width: 50px;">type</th>
           <th style="width: 50px;">default</th>
           <th>description</th>
         </tr>
        </thead>
        <tbody>
         <tr>
           <td>interval</td>
           <td>number</td>
           <td>5000</td>
           <td>The amount of time to delay between automatically cycling an item. If false, carousel will not automatically cycle.</td>
         </tr>
         <tr>
           <td>pause</td>
           <td>string</td>
           <td>"hover"</td>
           <td>Pauses the cycling of the carousel on mouseenter and resumes the cycling of the carousel on mouseleave.</td>
         </tr>
Jacob Thornton's avatar
Jacob Thornton committed
1973
1974
1975
1976
1977
1978
         <tr>
           <td>wrap</td>
           <td>boolean</td>
           <td>true</td>
           <td>Whether the carousel should cycle continuously or have hard stops.</td>
         </tr>
1979
1980
        </tbody>
      </table>
1981
    </div><!-- /.table-responsive -->
1982
1983
1984
1985
1986

    <h3>Methods</h3>

    <h4>.carousel(options)</h4>
    <p>Initializes the carousel with an optional options <code>object</code> and starts cycling through items.</p>
saiwang's avatar
saiwang committed
1987
{% highlight js %}
Mark Otto's avatar
Mark Otto committed
1988
1989
1990
1991
1992
$('.carousel').carousel({
  interval: 2000
})
{% endhighlight %}

1993
1994
1995
1996
1997
1998
1999
2000
    <h4>.carousel('cycle')</h4>
    <p>Cycles through the carousel items from left to right.</p>

    <h4>.carousel('pause')</h4>
    <p>Stops the carousel from cycling through items.</p>


    <h4>.carousel(number)</h4>
For faster browsing, not all history is shown. View entire blame