aboutsummaryrefslogtreecommitdiff
path: root/javascript.html
diff options
context:
space:
mode:
authorMark Otto <[email protected]>2013-10-20 22:55:45 -0700
committerMark Otto <[email protected]>2013-10-20 22:55:45 -0700
commit2eec3f919e7bd7ee847c2631ae9c53515cac1c8f (patch)
treeb9dd9c6b61fcb72aafe47dd85beac8cfb9da4fe2 /javascript.html
parentab3d0a27b3d93eebff3852728f94ddc4fcb35199 (diff)
parent6585c5898a47deb2df5f7db4f9ef3fe8fa1e5a4a (diff)
downloadbootstrap-2eec3f919e7bd7ee847c2631ae9c53515cac1c8f.tar.xz
bootstrap-2eec3f919e7bd7ee847c2631ae9c53515cac1c8f.zip
Merge branch 'master' into pr/10656
Conflicts: dist/css/bootstrap.min.css
Diffstat (limited to 'javascript.html')
-rw-r--r--javascript.html82
1 files changed, 60 insertions, 22 deletions
diff --git a/javascript.html b/javascript.html
index bc6d13238..eb051a87b 100644
--- a/javascript.html
+++ b/javascript.html
@@ -24,7 +24,7 @@ base_url: "../"
<div class="bs-callout bs-callout-danger">
<h4>Plugin dependencies</h4>
- <p>Some plugins and CSS components depend on other plugins. If you include plugins individually, make sure to check for these dependencies in the docs. Also note that all plugins depend on jQuery (this means jQuery must be included <strong>before</strong> the plugin files).</p>
+ <p>Some plugins and CSS components depend on other plugins. If you include plugins individually, make sure to check for these dependencies in the docs. Also note that all plugins depend on jQuery (this means jQuery must be included <strong>before</strong> the plugin files). <a href="{{ site.repo }}/blob/v{{ site.current_version }}/bower.json">Consult our <code>bower.json</code></a> to see which versions of jQuery are supported.</p>
</div>
<h3 id="js-data-attrs">Data attributes</h3>
@@ -104,6 +104,15 @@ $('#myModal').on('show.bs.modal', function (e) {
<h2 id="modals-examples">Examples</h2>
<p>Modals are streamlined, but flexible, dialog prompts with the minimum required functionality and smart defaults.</p>
+ <div class="bs-callout bs-callout-warning" id="callout-stacked-modals">
+ <h4>Overlapping modals not supported</h4>
+ <p>Be sure not to open a modal while another is still visible. Showing more than one modal at a time requires custom code.</p>
+ </div>
+ <div class="bs-callout bs-callout-warning">
+ <h4>Mobile device caveats</h4>
+ <p>There are some caveats regarding using modals on mobile devices. <a href="{{ page.base_url }}getting-started#mobile-modals">See our browser support docs</a> for details.</p>
+ </div>
+
<h3>Static example</h3>
<p>A rendered modal with header, body, and set of actions in the footer.</p>
<div class="bs-example bs-example-modal">
@@ -227,6 +236,7 @@ $('#myModal').on('show.bs.modal', function (e) {
</div>
<h2 id="modals-usage">Usage</h2>
+ <p>The modal plugin toggles your hidden content on demand, via data attributes or JavaScript. It also adds <code>.model-open</code> to the <code>&lt;body&gt;</code> to override default scrolling behavior and generates a <code>.modal-backdrop</code> to provide a click area for dismissing shown modals when clicking outside the modal.</p>
<h3>Via data attributes</h3>
<p>Activate a modal without writing JavaScript. Set <code>data-toggle="modal"</code> on a controller element, like a button, along with a <code>data-target="#foo"</code> or <code>href="#foo"</code> to target a specific modal to toggle.</p>
@@ -253,7 +263,7 @@ $('#myModal').on('show.bs.modal', function (e) {
<tbody>
<tr>
<td>backdrop</td>
- <td>boolean</td>
+ <td>boolean or the string <code>'static'</code></td>
<td>true</td>
<td>Includes a modal-backdrop element. Alternatively, specify <code>static</code> for a backdrop which doesn't close the modal on click.</td>
</tr>
@@ -444,6 +454,7 @@ $('#myModal').on('hidden.bs.modal', function () {
<h2 id="dropdowns-usage">Usage</h2>
+ <p>Via data attributes or JavaScript, the dropdown plugin toggles hidden content (dropdown menus) by toggling the <code>.open</code> class on the parent list item. When opened, the plugin also adds <code>.dropdown-backdrop</code> as a click area for closing dropdown menus when clicking outside the menu.</p>
<h3>Via data attributes</h3>
<p>Add <code>data-toggle="dropdown"</code> to a link or button to toggle a dropdown.</p>
@@ -461,6 +472,8 @@ $('#myModal').on('hidden.bs.modal', function () {
<a id="dLabel" role="button" data-toggle="dropdown" data-target="#" href="/page.html">
Dropdown <span class="caret"></span>
</a>
+
+
<ul class="dropdown-menu" role="menu" aria-labelledby="dLabel">
...
</ul>
@@ -711,7 +724,7 @@ $('#myTab li:eq(2) a').tab('show') // Select third tab (0-indexed)
{% endhighlight %}
<h3>Markup</h3>
- <p>You can activate a tab or pill navigation without writing any JavaScript by simply specifying <code>data-toggle="tab"</code> or <code>data-toggle="pill"</code> on an element. Adding the <code>nav</code> and <code>nav-tabs</code> classes to the tab <code>ul</code> will apply the Bootstrap tab styling.</p>
+ <p>You can activate a tab or pill navigation without writing any JavaScript by simply specifying <code>data-toggle="tab"</code> or <code>data-toggle="pill"</code> on an element. Adding the <code>nav</code> and <code>nav-tabs</code> classes to the tab <code>ul</code> will apply the Bootstrap <a href="{{ page.base_url }}components#nav-tabs">tab styling</a>, while adding the <code>nav</code> and <code>nav-pills</code> classes will apply <a href="{{ page.base_url }}components#nav-pills">pill styling</a>.</p>
{% highlight html %}
<!-- Nav tabs -->
<ul class="nav nav-tabs">
@@ -748,10 +761,10 @@ $('#myTab li:eq(2) a').tab('show') // Select third tab (0-indexed)
</p>
{% highlight html %}
<ul class="nav nav-tabs" id="myTab">
- <li class="active"><a href="#home">Home</a></li>
- <li><a href="#profile">Profile</a></li>
- <li><a href="#messages">Messages</a></li>
- <li><a href="#settings">Settings</a></li>
+ <li class="active"><a href="#home" data-toggle="tab">Home</a></li>
+ <li><a href="#profile" data-toggle="tab">Profile</a></li>
+ <li><a href="#messages" data-toggle="tab">Messages</a></li>
+ <li><a href="#settings" data-toggle="tab">Settings</a></li>
</ul>
<div class="tab-content">
@@ -824,21 +837,37 @@ $('a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
</div>
</div><!-- /example -->
+ <div class="bs-callout bs-callout-danger">
+ <h4>Opt-in functionality</h4>
+ <p>For performance reasons, the Tooltip and Popover data-apis are opt-in, meaning <strong>you must initialize them yourself</strong>.</p>
+ </div>
<div class="bs-callout bs-callout-info">
<h4>Tooltips in button groups and input groups require special setting</h4>
<p>When using tooltips on elements within a <code>.btn-group</code> or an <code>.input-group</code>, you'll have to specify the option <code>container: 'body'</code> (documented below) to avoid unwanted side effects (such as the element growing wider and/or losing its rounded corners when the tooltip is triggered).</p>
</div>
<div class="bs-callout bs-callout-info">
<h4>Tooltips on disabled elements require wrapper elements</h4>
- <p>To add a tooltip to a <code>disabled</code> or <code>.disabled</code> element, put the element inside of a <code>&lt;div&gt;</code> or <code>&lt;span&gt;</code>, and apply the tooltip to that element instead.</p>
+ <p>To add a tooltip to a <code>disabled</code> or <code>.disabled</code> element, put the element inside of a <code>&lt;div&gt;</code> and apply the tooltip to that <code>&lt;div&gt;</code> instead.</p>
</div>
<h2 id="tooltips-usage">Usage</h2>
+ <p>The tooltip plugin generates content and markup on demand, and by default places tooltips after their trigger element.</p>
<p>Trigger the tooltip via JavaScript:</p>
{% highlight js %}
$('#example').tooltip(options)
{% endhighlight %}
+ <h3>Markup</h3>
+ <p>The generated markup of a tooltip is rather simple, though it does require a position (by default, set to <code>top</code> by the plugin).</p>
+{% highlight html linenos %}
+<div class="tooltip">
+ <div class="tooltip-inner">
+ Tooltip!
+ </div>
+ <div class="tooltip-arrow"></div>
+</div>
+{% endhighlight %}
+
<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>
<div class="table-responsive">
@@ -990,13 +1019,17 @@ $('#myTooltip').on('hidden.bs.tooltip', function () {
<h4>Plugin dependency</h4>
<p>Popovers require the <a href="#tooltips">tooltip plugin</a> to be included in your version of Bootstrap.</p>
</div>
+ <div class="bs-callout bs-callout-danger">
+ <h4>Opt-in functionality</h4>
+ <p>For performance reasons, the Tooltip and Popover data-apis are opt-in, meaning <strong>you must initialize them yourself</strong>.</p>
+ </div>
<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>
<div class="bs-callout bs-callout-info">
<h4>Popovers on disabled elements require wrapper elements</h4>
- <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> or <code>&lt;span&gt;</code>, and apply the popover to that element instead.</p>
+ <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>
</div>
<h3>Static popover</h3>
@@ -1021,6 +1054,7 @@ $('#myTooltip').on('hidden.bs.tooltip', function () {
<div class="popover bottom">
<div class="arrow"></div>
<h3 class="popover-title">Popover bottom</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>
@@ -1100,7 +1134,7 @@ $('#myTooltip').on('hidden.bs.tooltip', function () {
<td>selector</td>
<td>string</td>
<td>false</td>
- <td>if a selector is provided, tooltip objects will be delegated to the specified targets 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>
+ <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>
</tr>
<tr>
<td>trigger</td>
@@ -1146,9 +1180,6 @@ $('#myTooltip').on('hidden.bs.tooltip', function () {
<p>Options for individual popovers can alternatively be specified through the use of data attributes, as explained above.</p>
</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>
-
<h3>Methods</h3>
<h4>$().popover(options)</h4>
<p>Initializes popovers for an element collection.</p>
@@ -1448,7 +1479,7 @@ $('.btn-group').button()
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title">
- <a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion" href="#collapseOne">
+ <a data-toggle="collapse" data-parent="#accordion" href="#collapseOne">
Collapsible Group Item #1
</a>
</h4>
@@ -1462,7 +1493,7 @@ $('.btn-group').button()
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title">
- <a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion" href="#collapseTwo">
+ <a data-toggle="collapse" data-parent="#accordion" href="#collapseTwo">
Collapsible Group Item #2
</a>
</h4>
@@ -1476,7 +1507,7 @@ $('.btn-group').button()
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title">
- <a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion" href="#collapseThree">
+ <a data-toggle="collapse" data-parent="#accordion" href="#collapseThree">
Collapsible Group Item #3
</a>
</h4>
@@ -1494,7 +1525,7 @@ $('.btn-group').button()
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title">
- <a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion" href="#collapseOne">
+ <a data-toggle="collapse" data-parent="#accordion" href="#collapseOne">
Collapsible Group Item #1
</a>
</h4>
@@ -1508,7 +1539,7 @@ $('.btn-group').button()
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title">
- <a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion" href="#collapseTwo">
+ <a data-toggle="collapse" data-parent="#accordion" href="#collapseTwo">
Collapsible Group Item #2
</a>
</h4>
@@ -1522,7 +1553,7 @@ $('.btn-group').button()
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title">
- <a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion" href="#collapseThree">
+ <a data-toggle="collapse" data-parent="#accordion" href="#collapseThree">
Collapsible Group Item #3
</a>
</h4>
@@ -1547,6 +1578,13 @@ $('.btn-group').button()
<h2 id="collapse-usage">Usage</h2>
+ <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>
<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>
@@ -1657,7 +1695,7 @@ $('#myCollapsible').on('hidden.bs.collapse', function () {
<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">
- <div id="carousel-example-generic" class="carousel slide bs-docs-carousel-example">
+ <div id="carousel-example-generic" class="carousel slide" data-ride="carousel">
<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>
@@ -1683,7 +1721,7 @@ $('#myCollapsible').on('hidden.bs.collapse', function () {
</div>
</div><!-- /example -->
{% highlight html %}
-<div id="carousel-example-generic" class="carousel slide">
+<div id="carousel-example-generic" class="carousel slide" data-ride="carousel">
<!-- Indicators -->
<ol class="carousel-indicators">
<li data-target="#carousel-example-generic" data-slide-to="0" class="active"></li>
@@ -1719,7 +1757,7 @@ $('#myCollapsible').on('hidden.bs.collapse', function () {
<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">
- <div id="carousel-example-captions" class="carousel slide bs-docs-carousel-example">
+ <div id="carousel-example-captions" class="carousel slide" data-ride="carousel">
<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>