diff options
Diffstat (limited to 'docs/javascript.html')
-rw-r--r-- | docs/javascript.html | 141 |
1 files changed, 81 insertions, 60 deletions
diff --git a/docs/javascript.html b/docs/javascript.html index d956ffaf35..f4957d91cf 100644 --- a/docs/javascript.html +++ b/docs/javascript.html @@ -15,7 +15,7 @@ <!-- Le HTML5 shim, for IE6-8 support of HTML5 elements --> <!--[if lt IE 9]> - <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script> + <script src="assets/js/html5shiv.js"></script> <![endif]--> <!-- Le fav and touch icons --> @@ -161,7 +161,7 @@ $('#myModal').on('show', function (e) { <h1>Transitions <small>bootstrap-transition.js</small></h1> </div> <h3>About transitions</h3> - <p>For simple transition effects, include bootstrap-transition.js once alongside the other JS files. If you're using the compiled (or minified) bootstrap.js, there is no need to include this—it's already there.</p> + <p>For simple transition effects, include <strong>bootstrap-transition.js</strong> once alongside the other JS files. If you're using the compiled (or minified) <strong>bootstrap.js</strong>, there is no need to include this—it's already there.</p> <h3>Use cases</h3> <p>A few examples of the transition plugin:</p> <ul> @@ -405,21 +405,21 @@ $('#myModal').on('hidden', function () { <li class="dropdown"> <a id="drop1" href="#" role="button" class="dropdown-toggle" data-toggle="dropdown">Dropdown <b class="caret"></b></a> <ul class="dropdown-menu" role="menu" aria-labelledby="drop1"> - <li><a tabindex="-1" href="http://google.com">Action</a></li> - <li><a tabindex="-1" href="#anotherAction">Another action</a></li> - <li><a tabindex="-1" href="#">Something else here</a></li> - <li class="divider"></li> - <li><a tabindex="-1" href="#">Separated link</a></li> + <li role="presentation"><a role="menuitem" tabindex="-1" href="http://google.com">Action</a></li> + <li role="presentation"><a role="menuitem" tabindex="-1" href="#anotherAction">Another action</a></li> + <li role="presentation"><a role="menuitem" tabindex="-1" href="#">Something else here</a></li> + <li role="presentation" class="divider"></li> + <li role="presentation"><a role="menuitem" tabindex="-1" href="#">Separated link</a></li> </ul> </li> <li class="dropdown"> <a href="#" id="drop2" role="button" class="dropdown-toggle" data-toggle="dropdown">Dropdown 2 <b class="caret"></b></a> <ul class="dropdown-menu" role="menu" aria-labelledby="drop2"> - <li><a tabindex="-1" href="#">Action</a></li> - <li><a tabindex="-1" href="#">Another action</a></li> - <li><a tabindex="-1" href="#">Something else here</a></li> - <li class="divider"></li> - <li><a tabindex="-1" href="#">Separated link</a></li> + <li role="presentation"><a role="menuitem" tabindex="-1" href="#">Action</a></li> + <li role="presentation"><a role="menuitem" tabindex="-1" href="#">Another action</a></li> + <li role="presentation"><a role="menuitem" tabindex="-1" href="#">Something else here</a></li> + <li role="presentation" class="divider"></li> + <li role="presentation"><a role="menuitem" tabindex="-1" href="#">Separated link</a></li> </ul> </li> </ul> @@ -427,11 +427,11 @@ $('#myModal').on('hidden', function () { <li id="fat-menu" class="dropdown"> <a href="#" id="drop3" role="button" class="dropdown-toggle" data-toggle="dropdown">Dropdown 3 <b class="caret"></b></a> <ul class="dropdown-menu" role="menu" aria-labelledby="drop3"> - <li><a tabindex="-1" href="#">Action</a></li> - <li><a tabindex="-1" href="#">Another action</a></li> - <li><a tabindex="-1" href="#">Something else here</a></li> - <li class="divider"></li> - <li><a tabindex="-1" href="#">Separated link</a></li> + <li role="presentation"><a role="menuitem" tabindex="-1" href="#">Action</a></li> + <li role="presentation"><a role="menuitem" tabindex="-1" href="#">Another action</a></li> + <li role="presentation"><a role="menuitem" tabindex="-1" href="#">Something else here</a></li> + <li role="presentation" class="divider"></li> + <li role="presentation"><a role="menuitem" tabindex="-1" href="#">Separated link</a></li> </ul> </li> </ul> @@ -447,31 +447,31 @@ $('#myModal').on('hidden', function () { <li class="dropdown"> <a class="dropdown-toggle" id="drop4" role="button" data-toggle="dropdown" href="#">Dropdown <b class="caret"></b></a> <ul id="menu1" class="dropdown-menu" role="menu" aria-labelledby="drop4"> - <li><a tabindex="-1" href="#">Action</a></li> - <li><a tabindex="-1" href="#">Another action</a></li> - <li><a tabindex="-1" href="#">Something else here</a></li> - <li class="divider"></li> - <li><a tabindex="-1" href="#">Separated link</a></li> + <li role="presentation"><a role="menuitem" tabindex="-1" href="#">Action</a></li> + <li role="presentation"><a role="menuitem" tabindex="-1" href="#">Another action</a></li> + <li role="presentation"><a role="menuitem" tabindex="-1" href="#">Something else here</a></li> + <li role="presentation" class="divider"></li> + <li role="presentation"><a role="menuitem" tabindex="-1" href="#">Separated link</a></li> </ul> </li> <li class="dropdown"> <a class="dropdown-toggle" id="drop5" role="button" data-toggle="dropdown" href="#">Dropdown 2 <b class="caret"></b></a> <ul id="menu2" class="dropdown-menu" role="menu" aria-labelledby="drop5"> - <li><a tabindex="-1" href="#">Action</a></li> - <li><a tabindex="-1" href="#">Another action</a></li> - <li><a tabindex="-1" href="#">Something else here</a></li> - <li class="divider"></li> - <li><a tabindex="-1" href="#">Separated link</a></li> + <li role="presentation"><a role="menuitem" tabindex="-1" href="#">Action</a></li> + <li role="presentation"><a role="menuitem" tabindex="-1" href="#">Another action</a></li> + <li role="presentation"><a role="menuitem" tabindex="-1" href="#">Something else here</a></li> + <li role="presentation" class="divider"></li> + <li role="presentation"><a role="menuitem" tabindex="-1" href="#">Separated link</a></li> </ul> </li> <li class="dropdown"> <a class="dropdown-toggle" id="drop5" role="button" data-toggle="dropdown" href="#">Dropdown 3 <b class="caret"></b></a> <ul id="menu3" class="dropdown-menu" role="menu" aria-labelledby="drop5"> - <li><a tabindex="-1" href="#">Action</a></li> - <li><a tabindex="-1" href="#">Another action</a></li> - <li><a tabindex="-1" href="#">Something else here</a></li> - <li class="divider"></li> - <li><a tabindex="-1" href="#">Separated link</a></li> + <li role="presentation"><a role="menuitem" tabindex="-1" href="#">Action</a></li> + <li role="presentation"><a role="menuitem" tabindex="-1" href="#">Another action</a></li> + <li role="presentation"><a role="menuitem" tabindex="-1" href="#">Something else here</a></li> + <li role="presentation" class="divider"></li> + <li role="presentation"><a role="menuitem" tabindex="-1" href="#">Separated link</a></li> </ul> </li> </ul> <!-- /tabs --> @@ -767,23 +767,27 @@ $('a[data-toggle="tab"]').on('shown', function (e) { <h2>Examples</h2> <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> + <p>For performance reasons, the tooltip and popover data-apis are opt in, meaning <strong>you must initialize them yourself</strong>.</p> <p>Hover over the links below to see tooltips:</p> <div class="bs-docs-example tooltip-demo"> - <p class="muted" style="margin-bottom: 0;">Tight pants next level keffiyeh <a href="#" rel="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="#" rel="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="#" rel="tooltip" title="Another one here too">whatever keytar</a>, scenester farm-to-table banksy Austin <a href="#" rel="tooltip" title="The last tip!">twitter handle</a> freegan cred raw denim single-origin coffee viral. + <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="A much longer tooltip belongs right here to demonstrate the max-width we apply.">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. </p> </div> <h3>Four directions</h3> <div class="bs-docs-example tooltip-demo"> <ul class="bs-docs-tooltip-examples"> - <li><a href="#" rel="tooltip" data-placement="top" title="Tooltip on top">Tooltip on top</a></li> - <li><a href="#" rel="tooltip" data-placement="right" title="Tooltip on right">Tooltip on right</a></li> - <li><a href="#" rel="tooltip" data-placement="bottom" title="Tooltip on bottom">Tooltip on bottom</a></li> - <li><a href="#" rel="tooltip" data-placement="left" title="Tooltip on left">Tooltip on left</a></li> + <li><a href="#" data-toggle="tooltip" data-placement="top" title="Tooltip on top">Tooltip on top</a></li> + <li><a href="#" data-toggle="tooltip" data-placement="right" title="Tooltip on right">Tooltip on right</a></li> + <li><a href="#" data-toggle="tooltip" data-placement="bottom" title="Tooltip on bottom">Tooltip on bottom</a></li> + <li><a href="#" data-toggle="tooltip" data-placement="left" title="Tooltip on left">Tooltip on left</a></li> </ul> </div> + <h3>Tooltips in input groups</h3> + <p>When using tooltips and popovers with the Bootstrap input groups, you'll have to set the <code>container</code> (documented below) option to avoid unwanted side effects.</p> + <hr class="bs-docs-separator"> @@ -817,7 +821,7 @@ $('a[data-toggle="tab"]').on('shown', function (e) { </tr> <tr> <td>placement</td> - <td>string|function</td> + <td>string | function</td> <td>'top'</td> <td>how to position the tooltip - top | bottom | left | right</td> </tr> @@ -836,8 +840,8 @@ $('a[data-toggle="tab"]').on('shown', function (e) { <tr> <td>trigger</td> <td>string</td> - <td>'hover'</td> - <td>how tooltip is triggered - click | hover | focus | manual</td> + <td>'hover focus'</td> + <td>how tooltip is triggered - click | hover | focus | manual. Note you case pass trigger mutliple, space seperated, trigger types.</td> </tr> <tr> <td>delay</td> @@ -849,6 +853,14 @@ $('a[data-toggle="tab"]').on('shown', function (e) { <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 <code>container: 'body'</code></p> + </td> + </tr> </tbody> </table> <div class="alert alert-info"> @@ -857,8 +869,7 @@ $('a[data-toggle="tab"]').on('shown', function (e) { </div> <h3>Markup</h3> - <p>For performance reasons, the Tooltip and Popover data-apis are opt in. If you would like to use them just specify a selector option.</p> - <pre class="prettyprint linenums"><a href="#" rel="tooltip" title="first tooltip">hover over me</a></pre> + <pre class="prettyprint linenums"><a href="#" data-toggle="tooltip" title="first tooltip">hover over me</a></pre> <h3>Methods</h3> <h4>$().tooltip(options)</h4> @@ -930,16 +941,16 @@ $('a[data-toggle="tab"]').on('shown', function (e) { <h3>Live demo</h3> <div class="bs-docs-example" style="padding-bottom: 24px;"> - <a href="#" class="btn btn-large btn-danger" rel="popover" title="A Title" data-content="And here's some amazing content. It's very engaging. right?">Click to toggle popover</a> + <a href="#" class="btn btn-large btn-danger" data-toggle="popover" title="A Title" data-content="And here's some amazing content. It's very engaging. right?">Click to toggle popover</a> </div> <h4>Four directions</h4> <div class="bs-docs-example tooltip-demo"> <ul class="bs-docs-tooltip-examples"> - <li><a href="#" class="btn" rel="popover" data-placement="top" data-content="Vivamus sagittis lacus vel augue laoreet rutrum faucibus." title="Popover on top">Popover on top</a></li> - <li><a href="#" class="btn" rel="popover" data-placement="right" data-content="Vivamus sagittis lacus vel augue laoreet rutrum faucibus." title="Popover on right">Popover on right</a></li> - <li><a href="#" class="btn" rel="popover" data-placement="bottom" data-content="Vivamus sagittis lacus vel augue laoreet rutrum faucibus." title="Popover on bottom">Popover on bottom</a></li> - <li><a href="#" class="btn" rel="popover" data-placement="left" data-content="Vivamus sagittis lacus vel augue laoreet rutrum faucibus." title="Popover on left">Popover on left</a></li> + <li><a href="#" class="btn" data-toggle="popover" data-placement="top" data-content="Vivamus sagittis lacus vel augue laoreet rutrum faucibus." title="Popover on top">Popover on top</a></li> + <li><a href="#" class="btn" data-toggle="popover" data-placement="right" data-content="Vivamus sagittis lacus vel augue laoreet rutrum faucibus." title="Popover on right">Popover on right</a></li> + <li><a href="#" class="btn" data-toggle="popover" data-placement="bottom" data-content="Vivamus sagittis lacus vel augue laoreet rutrum faucibus." title="Popover on bottom">Popover on bottom</a></li> + <li><a href="#" class="btn" data-toggle="popover" data-placement="left" data-content="Vivamus sagittis lacus vel augue laoreet rutrum faucibus." title="Popover on left">Popover on left</a></li> </ul> </div> @@ -977,7 +988,7 @@ $('a[data-toggle="tab"]').on('shown', function (e) { </tr> <tr> <td>placement</td> - <td>string|function</td> + <td>string | function</td> <td>'right'</td> <td>how to position the popover - top | bottom | left | right</td> </tr> @@ -1015,6 +1026,14 @@ $('a[data-toggle="tab"]').on('shown', function (e) { <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 popover to a specific element <code>container: 'body'</code></p> + </td> + </tr> </tbody> </table> <div class="alert alert-info"> @@ -1422,6 +1441,11 @@ $('#myCollapsible').on('hidden', function () { <p>The slideshow below shows a generic plugin and component for cycling through elements like a carousel.</p> <div class="bs-docs-example"> <div id="myCarousel" class="carousel slide"> + <ol class="carousel-indicators"> + <li data-target="#myCarousel" data-slide-to="0" class="active"></li> + <li data-target="#myCarousel" data-slide-to="1"></li> + <li data-target="#myCarousel" data-slide-to="2"></li> + </ol> <div class="carousel-inner"> <div class="item active"> <img src="assets/img/bootstrap-mdo-sfmoma-01.jpg" alt=""> @@ -1451,6 +1475,11 @@ $('#myCollapsible').on('hidden', function () { </div> <pre class="prettyprint linenums"> <div id="myCarousel" class="carousel slide"> + <ol class="carousel-indicators"> + <li data-target="#myCarousel" data-slide-to="0" class="active"></li> + <li data-target="#myCarousel" data-slide-to="1"></li> + <li data-target="#myCarousel" data-slide-to="2"></li> + </ol> <!-- Carousel items --> <div class="carousel-inner"> <div class="active item">…</div> @@ -1475,14 +1504,14 @@ $('#myCollapsible').on('hidden', function () { <h2>Usage</h2> <h3>Via data attributes</h3> - <p>...</p> + <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 it's 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 jump's the slide position to a particular index beginning with <code>0</code>.</p> <h3>Via JavaScript</h3> <p>Call carousel manually with:</p> <pre class="prettyprint linenums">$('.carousel').carousel()</pre> <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> + <p>Options can be passed via data attributes or JavaScriptz. For data attributes, append the option name to <code>data-</code>, as in <code>data-interval=""</code>.</p> <table class="table table-bordered table-striped"> <thead> <tr> @@ -1565,7 +1594,7 @@ $('.carousel').carousel({ <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"]'> </div> <pre class="prettyprint linenums"><input type="text" data-provide="typeahead"></pre> - + <p>You'll want to set <code>autocomplete="off"</code> to prevent default browser menus from appearing over the Bootstrap typeahead dropdown.</p> <hr class="bs-docs-separator"> @@ -1671,14 +1700,6 @@ $('.carousel').carousel({ <p>Call the affix plugin via JavaScript:</p> <pre class="prettyprint linenums">$('#navbar').affix()</pre> - <h3>Methods</h3> - <h4>.affix('refresh')</h4> - <p>When using affix in conjunction with adding or removing of elements from the DOM, you'll want to call the refresh method:</p> -<pre class="prettyprint linenums"> -$('[data-spy="affix"]').each(function () { - $(this).affix('refresh') -}); -</pre> <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-offset-top="200"</code>.</p> <table class="table table-bordered table-striped"> @@ -1722,7 +1743,7 @@ $('[data-spy="affix"]').each(function () { <li class="muted">·</li> <li><a href="https://github.com/twitter/bootstrap/issues?state=open">Issues</a></li> <li class="muted">·</li> - <li><a href="https://github.com/twitter/bootstrap/wiki">Roadmap and changelog</a></li> + <li><a href="https://github.com/twitter/bootstrap/blob/master/CHANGELOG.md">Changelog</a></li> </ul> </div> </footer> |