javascript.html 72.5 KB
Newer Older
Jacob Thornton's avatar
Jacob Thornton committed
1001
1002
1003
1004
1005
1006
        <h1>Buttons <small>bootstrap-button.js</small></h1>
      </div>
      <div class="row">
        <div class="span3 columns">
          <h3>About</h3>
          <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
1007
          <a href="assets/js/bootstrap-button.js" target="_blank" class="btn">Download file</a>
Jacob Thornton's avatar
Jacob Thornton committed
1008
1009
1010
1011
1012
1013
1014
1015
1016
        </div>
        <div class="span9 columns">
          <h2>Example uses</h2>
          <p>Use the buttons plugin for states and toggles.</p>
          <table class="table table-bordered table-striped">
            <tbody>
             <tr>
               <td>Stateful</td>
               <td>
1017
                  <button id="fat-btn" data-loading-text="loading..." class="btn btn-primary">
Jacob Thornton's avatar
Jacob Thornton committed
1018
1019
1020
1021
1022
1023
1024
                    Loading State
                  </button>
                </td>
             </tr>
             <tr>
               <td>Single toggle</td>
               <td>
1025
                  <button class="btn btn-primary" data-toggle="button">Single Toggle</button>
Jacob Thornton's avatar
Jacob Thornton committed
1026
1027
1028
1029
1030
1031
                </td>
             </tr>
             <tr>
               <td>Checkbox</td>
               <td>
                  <div class="btn-group" data-toggle="buttons-checkbox">
1032
1033
1034
                    <button class="btn btn-primary">Left</button>
                    <button class="btn btn-primary">Middle</button>
                    <button class="btn btn-primary">Right</button>
Jacob Thornton's avatar
Jacob Thornton committed
1035
1036
1037
1038
1039
1040
1041
                  </div>
               </td>
             </tr>
             <tr>
               <td>Radio</td>
               <td>
                  <div class="btn-group" data-toggle="buttons-radio">
1042
1043
1044
                    <button class="btn btn-primary">Left</button>
                    <button class="btn btn-primary">Middle</button>
                    <button class="btn btn-primary">Right</button>
Jacob Thornton's avatar
Jacob Thornton committed
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
                  </div>
               </td>
             </tr>
            </tbody>
          </table>
          <hr>
          <h2>Using bootstrap-button.js</h2>
          <p>Enable buttons via javascript:</p>
          <pre class="prettyprint linenums">$('.tabs').button()</pre>
            <h3>Markup</h3>
          <p>Data attributes are integral to the button plugin. Check out the example code below for the various markup types.</p>
1056
1057
1058
1059
1060
1061
<pre class="prettyprint linenums">
&lt;!-- Add data-toggle="button" to activate toggling on a single button --&gt;
&lt;button class="btn" data-toggle="button"&gt;Single Toggle&lt;/button&gt;

&lt;!-- Add data-toggle="buttons-checkbox" for checkbox style toggling on btn-group --&gt;
&lt;div class="btn-group" data-toggle="buttons-checkbox"&gt;
Jacob Thornton's avatar
Jacob Thornton committed
1062
1063
1064
  &lt;button class="btn"&gt;Left&lt;/button&gt;
  &lt;button class="btn"&gt;Middle&lt;/button&gt;
  &lt;button class="btn"&gt;Right&lt;/button&gt;
1065
1066
1067
1068
&lt;/div&gt;

&lt;!-- Add data-toggle="buttons-radio" for radio style toggling on btn-group --&gt;
&lt;div class="btn-group" data-toggle="buttons-radio"&gt;
Jacob Thornton's avatar
Jacob Thornton committed
1069
1070
1071
  &lt;button class="btn"&gt;Left&lt;/button&gt;
  &lt;button class="btn"&gt;Middle&lt;/button&gt;
  &lt;button class="btn"&gt;Right&lt;/button&gt;
1072
1073
&lt;/div&gt;
</pre>
Jacob Thornton's avatar
Jacob Thornton committed
1074
1075
          <h3>Methods</h3>
          <h4>$().button('toggle')</h4>
Mark Otto's avatar
Mark Otto committed
1076
          <p>Toggles push state. Gives the button the appearance that it has been activated.</p>
1077
1078
1079
1080
          <div class="alert alert-info">
            <strong>Heads up!</strong>
            You can enable auto toggling of a button by using the <code>data-toggle</code> attribute.
          </div>
1081
          <pre class="prettyprint linenums">&lt;button class="btn" data-toggle="button" &gt;&lt;/button&gt;</pre>
Jacob Thornton's avatar
Jacob Thornton committed
1082
1083
1084
          <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>
1085
1086
1087
1088
1089
1090
1091
1092
1093
          <pre class="prettyprint linenums">&lt;button class="btn" data-loading-text="loading stuff..." &gt;...&lt;/button&gt;</pre>
          <div class="alert alert-info">
            <strong>Heads up!</strong>
            <a href="https://github.com/twitter/bootstrap/issues/793">Firefox persists the disabled state across page loads</a>. A workaround for this is to use <code>autocomplete="off"</code>.
          </div>
          <h4>$().button('reset')</h4>
          <p>Resets button state - swaps text to original text.</p>
          <h4>$().button(string)</h4>
          <p>Resets button state - swaps text to any data defined text state.</p>
1094
1095
<pre class="prettyprint linenums">&lt;button class="btn" data-complete-text="finished!" &gt;...&lt;/button&gt;
&lt;script&gt;
Jacob Thornton's avatar
Jacob Thornton committed
1096
  $('.btn').button('complete')
1097
&lt;/script&gt;</pre>
1098
        </div>
Jacob Thornton's avatar
Jacob Thornton committed
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
      </div>
    </section>



    <!-- Collapse
    ================================================== -->
    <section id="collapse">
      <div class="page-header">
        <h1>Collapse <small>bootstrap-collapse.js</small></h1>
      </div>
      <div class="row">
        <div class="span3 columns">
          <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
1114
          <a href="assets/js/bootstrap-collapse.js" target="_blank" class="btn">Download file</a>
1115
        </div>
Jacob Thornton's avatar
Jacob Thornton committed
1116
1117
1118
        <div class="span9 columns">
          <h2>Example accordion</h2>
          <p>Using the collapse plugin, we built a simple accordion style widget:</p>
1119

Jacob Thornton's avatar
Jacob Thornton committed
1120
1121
1122
          <div class="accordion" id="accordion2">
            <div class="accordion-group">
              <div class="accordion-heading">
Mark Otto's avatar
Mark Otto committed
1123
                <a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion2" href="#collapseOne">
Jacob Thornton's avatar
Jacob Thornton committed
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
                  Collapsible Group Item #1
                </a>
              </div>
              <div id="collapseOne" class="accordion-body collapse in">
                <div class="accordion-inner">
                  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 class="accordion-group">
              <div class="accordion-heading">
Mark Otto's avatar
Mark Otto committed
1135
                <a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion2" href="#collapseTwo">
Jacob Thornton's avatar
Jacob Thornton committed
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
                  Collapsible Group Item #2
                </a>
              </div>
              <div id="collapseTwo" class="accordion-body collapse">
                <div class="accordion-inner">
                  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 class="accordion-group">
              <div class="accordion-heading">
Mark Otto's avatar
Mark Otto committed
1147
                <a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion2" href="#collapseThree">
Jacob Thornton's avatar
Jacob Thornton committed
1148
1149
1150
1151
1152
1153
1154
1155
                  Collapsible Group Item #3
                </a>
              </div>
              <div id="collapseThree" class="accordion-body collapse">
                <div class="accordion-inner">
                  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>
1156
1157
1158
            </div>
          </div>

1159

Jacob Thornton's avatar
Jacob Thornton committed
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
          <hr>
          <h2>Using bootstrap-collapse.js</h2>
          <p>Enable via javascript:</p>
          <pre class="prettyprint linenums">$(".collapse").collapse()</pre>
          <h3>Options</h3>
          <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>
Kyle Robinson Young's avatar
Kyle Robinson Young committed
1179
               <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)</td>
Jacob Thornton's avatar
Jacob Thornton committed
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
             </tr>
             <tr>
               <td>toggle</td>
               <td>boolean</td>
               <td>true</td>
               <td>Toggles the collapsible element on invocation</td>
             </tr>
            </tbody>
          </table>
          <h3>Markup</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>
          <pre class="prettyprint linenums">
1192
&lt;button class="btn btn-danger" data-toggle="collapse" data-target="#demo"&gt;
Jacob Thornton's avatar
Jacob Thornton committed
1193
  simple collapsible
1194
1195
&lt;/button&gt;

1196
&lt;div id="demo" class="collapse in"&gt;&lt;/div&gt;</pre>
1197
1198
1199
1200
          <div class="alert alert-info">
            <strong>Heads up!</strong>
            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.
          </div>
Jacob Thornton's avatar
Jacob Thornton committed
1201
1202
1203
          <h3>Methods</h3>
          <h4>.collapse(options)</h4>
          <p>Activates your content as a collapsible element. Accepts an optional options <code>object</code>.
1204
1205
<pre class="prettyprint linenums">
$('#myCollapsible').collapse({
Jacob Thornton's avatar
Jacob Thornton committed
1206
  toggle: false
1207
})</pre>
Jacob Thornton's avatar
Jacob Thornton committed
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
          <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>
          <table class="table table-bordered table-striped">
            <thead>
             <tr>
               <th style="width: 150px;">Event</th>
               <th>Description</th>
             </tr>
            </thead>
            <tbody>
             <tr>
Mark Otto's avatar
Mark Otto committed
1227
               <td>show</td>
Jacob Thornton's avatar
Jacob Thornton committed
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
               <td>This event fires immediately when the <code>show</code> instance method is called.</td>
             </tr>
             <tr>
               <td>shown</td>
               <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>
               <td>hide</td>
               <td>
                This event is fired immediately when the <code>hide</code> method has been called.
               </td>
             </tr>
             <tr>
               <td>hidden</td>
               <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>
1246

1247
<pre class="prettyprint linenums">
1248
$('#myCollapsible').on('hidden', function () {
1249
  // do something…
1250
})</pre>
1251
1252
        </div>
      </div>
Jacob Thornton's avatar
Jacob Thornton committed
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
    </section>



     <!-- Carousel
    ================================================== -->
    <section id="carousel">
      <div class="page-header">
        <h1>Carousel <small>bootstrap-carousel.js</small></h1>
      </div>
      <div class="row">
        <div class="span3 columns">
          <h3>About</h3>
          <p>A generic plugin for cycling through elements. A merry-go-round.</p>
Mark Otto's avatar
Mark Otto committed
1267
          <a href="assets/js/bootstrap-carousel.js" target="_blank" class="btn">Download file</a>
Jacob Thornton's avatar
Jacob Thornton committed
1268
1269
1270
1271
1272
1273
1274
        </div>
        <div class="span9 columns">
          <h2>Example carousel</h2>
          <p>Watch the slideshow below.</p>
          <div id="myCarousel" class="carousel slide">
            <div class="carousel-inner">
              <div class="item active">
1275
                <img src="assets/img/bootstrap-mdo-sfmoma-01.jpg" alt="">
Jacob Thornton's avatar
Jacob Thornton committed
1276
1277
1278
1279
1280
1281
                <div class="carousel-caption">
                  <h4>First Thumbnail label</h4>
                  <p>Cras justo odio, dapibus ac facilisis in, egestas eget quam. Donec id elit non mi porta gravida at eget metus. Nullam id dolor id nibh ultricies vehicula ut id elit.</p>
                </div>
              </div>
              <div class="item">
1282
                <img src="assets/img/bootstrap-mdo-sfmoma-02.jpg" alt="">
Jacob Thornton's avatar
Jacob Thornton committed
1283
1284
1285
1286
1287
1288
                <div class="carousel-caption">
                  <h4>Second Thumbnail label</h4>
                  <p>Cras justo odio, dapibus ac facilisis in, egestas eget quam. Donec id elit non mi porta gravida at eget metus. Nullam id dolor id nibh ultricies vehicula ut id elit.</p>
                </div>
              </div>
              <div class="item">
1289
                <img src="assets/img/bootstrap-mdo-sfmoma-03.jpg" alt="">
Jacob Thornton's avatar
Jacob Thornton committed
1290
1291
1292
1293
1294
1295
1296
1297
1298
                <div class="carousel-caption">
                  <h4>Third Thumbnail label</h4>
                  <p>Cras justo odio, dapibus ac facilisis in, egestas eget quam. Donec id elit non mi porta gravida at eget metus. Nullam id dolor id nibh ultricies vehicula ut id elit.</p>
                </div>
              </div>
            </div>
            <a class="left carousel-control" href="#myCarousel" data-slide="prev">&lsaquo;</a>
            <a class="right carousel-control" href="#myCarousel" data-slide="next">&rsaquo;</a>
          </div>
1299
1300
1301
1302
          <div class="alert alert-info">
            <strong>Heads up!</strong>
            When implementing this carousel, remove the images we have provided and replace them with your own.
          </div>
Jacob Thornton's avatar
Jacob Thornton committed
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
          <hr>
          <h2>Using bootstrap-carousel.js</h2>
          <p>Call via javascript:</p>
          <pre class="prettyprint linenums">$('.carousel').carousel()</pre>
          <h3>Options</h3>
          <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>
Mark Otto's avatar
Mark Otto committed
1322
               <td>The amount of time to delay between automatically cycling an item.</td>
Jacob Thornton's avatar
Jacob Thornton committed
1323
             </tr>
1324
1325
1326
1327
1328
1329
             <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
1330
1331
1332
            </tbody>
          </table>
          <h3>Markup</h3>
1333
          <p>Data attributes are used for the previous and next conrols. Check out the example markup below.</p>
1334
<pre class="prettyprint linenums">
Jacob Thornton's avatar
Jacob Thornton committed
1335
&lt;div id="myCarousel" class="carousel"&gt;
Jacob Thornton's avatar
Jacob Thornton committed
1336
1337
  &lt;!-- Carousel items --&gt;
  &lt;div class="carousel-inner"&gt;
Jacob Thornton's avatar
Jacob Thornton committed
1338
1339
1340
    &lt;div class="active item"&gt;&lt;/div&gt;
    &lt;div class="item"&gt;&lt;/div&gt;
    &lt;div class="item"&gt;&lt;/div&gt;
Jacob Thornton's avatar
Jacob Thornton committed
1341
1342
1343
1344
  &lt;/div&gt;
  &lt;!-- Carousel nav --&gt;
  &lt;a class="carousel-control left" href="#myCarousel" data-slide="prev"&gt;&amp;lsaquo;&lt;/a&gt;
  &lt;a class="carousel-control right" href="#myCarousel" data-slide="next"&gt;&amp;rsaquo;&lt;/a&gt;
1345
1346
&lt;/div&gt;
</pre>
Jacob Thornton's avatar
Jacob Thornton committed
1347
1348
1349
          <h3>Methods</h3>
          <h4>.carousel(options)</h4>
          <p>Initializes the carousel with an optional options <code>object</code> and starts cycling through items.</p>
1350
<pre class="prettyprint linenums">
Mark Otto's avatar
Mark Otto committed
1351
$('.carousel').carousel({
Jacob Thornton's avatar
Jacob Thornton committed
1352
  interval: 2000
1353
1354
})
</pre>
Jacob Thornton's avatar
Jacob Thornton committed
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
          <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>
          <p>Cycles the carousel to a particular frame (0 based, similar to an array).</p>
          <h4>.carousel('prev')</h4>
          <p>Cycles to the previous item.</p>
          <h4>.carousel('next')</h4>
          <p>Cycles to the next item.</p>
          <h3>Events</h3>
1366
          <p>Bootstrap's carousel class exposes two events for hooking into carousel functionality.</p>
Jacob Thornton's avatar
Jacob Thornton committed
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
          <table class="table table-bordered table-striped">
            <thead>
             <tr>
               <th style="width: 150px;">Event</th>
               <th>Description</th>
             </tr>
            </thead>
            <tbody>
             <tr>
               <td>slide</td>
               <td>This event fires immediately when the <code>slide</code> instance method is invoked.</td>
             </tr>
             <tr>
               <td>slid</td>
1381
               <td>This event is fired when the carousel has completed its slide transition.</td>
Jacob Thornton's avatar
Jacob Thornton committed
1382
1383
1384
1385
             </tr>
            </tbody>
          </table>
        </div>
1386
      </div>
Jacob Thornton's avatar
Jacob Thornton committed
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
    </section>



    <!-- Typeahead
    ================================================== -->
    <section id="typeahead">
      <div class="page-header">
        <h1>Typeahead <small>bootstrap-typeahead.js</small></h1>
      </div>
      <div class="row">
        <div class="span3 columns">
          <h3>About</h3>
          <p>A basic, easily extended plugin for quickly creating elegant typeaheads with any form text input.</p>
Mark Otto's avatar
Mark Otto committed
1401
          <a href="assets/js/bootstrap-typeahead.js" target="_blank" class="btn">Download file</a>
Jacob Thornton's avatar
Jacob Thornton committed
1402
1403
1404
1405
1406
        </div>
        <div class="span9 columns">
          <h2>Example</h2>
          <p>Start typing in the field below to show the typeahead results.</p>
          <div class="well">
1407
            <input type="text" class="span3" style="margin: 0 auto;" data-provide="typeahead" data-items="4" data-source='["Alabama","Alaska","Arizona","Arkansas","California","Colorado","Connecticut","Delaware","Florida","Georgia","Hawaii","Idaho","Illinois","Indiana","Iowa","Kansas","Kentucky","Louisiana","Maine","Maryland","Massachusetts","Michigan","Minnesota","Mississippi","Missouri","Montana","Nebraska","Nevada","New Hampshire","New Jersey","New Mexico","New York","North Dakota","North Carolina","Ohio","Oklahoma","Oregon","Pennsylvania","Rhode Island","South Carolina","South Dakota","Tennessee","Texas","Utah","Vermont","Virginia","Washington","West Virginia","Wisconsin","Wyoming"]'>
Jacob Thornton's avatar
Jacob Thornton committed
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
          </div>
          <hr>
          <h2>Using bootstrap-typeahead.js</h2>
          <p>Call the typeahead via javascript:</p>
          <pre class="prettyprint linenums">$('.typeahead').typeahead()</pre>
          <h3>Options</h3>
          <table class="table table-bordered table-striped">
            <thead>
             <tr>
               <th style="width: 100px;">Name</th>
               <th style="width: 50px;">type</th>
1419
               <th style="width: 100px;">default</th>
Jacob Thornton's avatar
Jacob Thornton committed
1420
1421
1422
1423
               <th>description</th>
             </tr>
            </thead>
            <tbody>
1424
1425
1426
1427
1428
1429
              <tr>
               <td>source</td>
               <td>array</td>
               <td>[ ]</td>
               <td>The data source to query against.</td>
             </tr>
Jacob Thornton's avatar
Jacob Thornton committed
1430
1431
1432
1433
1434
1435
             <tr>
               <td>items</td>
               <td>number</td>
               <td>8</td>
               <td>The max number of items to display in the dropdown.</td>
             </tr>
1436
1437
1438
             <tr>
               <td>matcher</td>
               <td>function</td>
1439
               <td>case insensitive</td>
1440
1441
1442
1443
1444
               <td>The method used to determine if a query matches an item. Accepts a single argument, the <code>item</code> against which to test the query. Access the current query with <code>this.query</code>. Return a boolean <code>true</code> if query is a match.</td>
             </tr>
             <tr>
               <td>sorter</td>
               <td>function</td>
1445
               <td>exact match,<br> case sensitive,<br> case insensitive</td>
1446
1447
               <td>Method used to sort autocomplete results. Accepts a single argument <code>items</code> and has the scope of the typeahead instance. Reference the current query with <code>this.query</code>.</td>
             </tr>
1448
1449
1450
1451
1452
1453
             <tr>
               <td>highlighter</td>
               <td>function</td>
               <td>highlights all default matches</td>
               <td>Method used to highlight autocomplete results. Accepts a single argument <code>item</code> and has the scope of the typeahead instance. Should return html.</td>
             </tr>
Jacob Thornton's avatar
Jacob Thornton committed
1454
1455
1456
1457
1458
            </tbody>
          </table>

          <h3>Markup</h3>
          <p>Add data attributes to register an element with typeahead functionality.</p>
1459
<pre class="prettyprint linenums">
1460
&lt;input type="text" data-provide="typeahead"&gt;
1461
</pre>
1462
1463
          <h3>Methods</h3>
          <h4>.typeahead(options)</h4>
Mark Otto's avatar
Mark Otto committed
1464
          <p>Initializes an input with a typeahead.</p>
Jacob Thornton's avatar
Jacob Thornton committed
1465
1466
1467
        </div>
      </div>
    </section>
1468

Jacob Thornton's avatar
Jacob Thornton committed
1469
     <!-- Footer
1470
      ================================================== -->
1471
      <footer class="footer">
Mark Otto's avatar
Mark Otto committed
1472
        <p class="pull-right"><a href="#">Back to top</a></p>
Mark Otto's avatar
Mark Otto committed
1473
1474
1475
        <p>Designed and built with all the love in the world <a href="http://twitter.com/twitter" target="_blank">@twitter</a> by <a href="http://twitter.com/mdo" target="_blank">@mdo</a> and <a href="http://twitter.com/fat" target="_blank">@fat</a>.</p>
        <p>Code licensed under the <a href="http://www.apache.org/licenses/LICENSE-2.0" target="_blank">Apache License v2.0</a>. Documentation licensed under <a href="http://creativecommons.org/licenses/by/3.0/">CC BY 3.0</a>.</p>
        <p>Icons from <a href="http://glyphicons.com">Glyphicons Free</a>, licensed under <a href="http://creativecommons.org/licenses/by/3.0/">CC BY 3.0</a>.</p>
1476
      </footer>
1477

1478
    </div><!-- /container -->
1479
1480


1481
1482
1483

    <!-- Le javascript
    ================================================== -->
1484
    <!-- Placed at the end of the document so the pages load faster -->
1485
    <script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script>
Jacob Thornton's avatar
Jacob Thornton committed
1486
    <script src="assets/js/jquery.js"></script>
1487
    <script src="assets/js/google-code-prettify/prettify.js"></script>
Jacob Thornton's avatar
Jacob Thornton committed
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
    <script src="assets/js/bootstrap-transition.js"></script>
    <script src="assets/js/bootstrap-alert.js"></script>
    <script src="assets/js/bootstrap-modal.js"></script>
    <script src="assets/js/bootstrap-dropdown.js"></script>
    <script src="assets/js/bootstrap-scrollspy.js"></script>
    <script src="assets/js/bootstrap-tab.js"></script>
    <script src="assets/js/bootstrap-tooltip.js"></script>
    <script src="assets/js/bootstrap-popover.js"></script>
    <script src="assets/js/bootstrap-button.js"></script>
    <script src="assets/js/bootstrap-collapse.js"></script>
    <script src="assets/js/bootstrap-carousel.js"></script>
    <script src="assets/js/bootstrap-typeahead.js"></script>
1500
    <script src="assets/js/application.js"></script>
1501
1502


Jacob Thornton's avatar
Jacob Thornton committed
1503
  </body>
Mark Otto's avatar
Mark Otto committed
1504
</html>
For faster browsing, not all history is shown. View entire blame