diff options
| author | Chris Rebert <[email protected]> | 2015-03-25 18:13:29 -0700 |
|---|---|---|
| committer | Chris Rebert <[email protected]> | 2015-03-25 18:13:29 -0700 |
| commit | e3c10d0d014ff4c9cf5e63cdb2cbf5bd59c7f7e8 (patch) | |
| tree | ecfb5cdb453782ce8a818e4b824d386e75b9113b | |
| parent | 2f3076f20acb6b34279b1ef77063a8fff33f756e (diff) | |
| parent | 343827081f75a0b27f7bcb0acd07b167e48f4cb7 (diff) | |
| download | bootstrap-e3c10d0d014ff4c9cf5e63cdb2cbf5bd59c7f7e8.tar.xz bootstrap-e3c10d0d014ff4c9cf5e63cdb2cbf5bd59c7f7e8.zip | |
Merge pull request #16156 from twbs/fix-16115
Properly document $(...).tab('show') method
| -rw-r--r-- | docs/_includes/js/tabs.html | 37 |
1 files changed, 10 insertions, 27 deletions
diff --git a/docs/_includes/js/tabs.html b/docs/_includes/js/tabs.html index b107ca6a2..8c4c3c08f 100644 --- a/docs/_includes/js/tabs.html +++ b/docs/_includes/js/tabs.html @@ -4,7 +4,7 @@ <h2 id="tabs-examples">Example tabs</h2> <p>Add quick, dynamic tab functionality to transition through panes of local content, even via dropdown menus.</p> <div class="bs-example bs-example-tabs" role="tabpanel" data-example-id="togglable-tabs"> - <ul id="myTab" class="nav nav-tabs" role="tablist"> + <ul id="myTabs" class="nav nav-tabs" role="tablist"> <li role="presentation" class="active"><a href="#home" id="home-tab" role="tab" data-toggle="tab" aria-controls="home" aria-expanded="true">Home</a></li> <li role="presentation"><a href="#profile" role="tab" id="profile-tab" data-toggle="tab" aria-controls="profile">Profile</a></li> <li role="presentation" class="dropdown"> @@ -41,7 +41,7 @@ <p>Enable tabbable tabs via JavaScript (each tab needs to be activated individually):</p> {% highlight js %} -$('#myTab a').click(function (e) { +$('#myTabs a').click(function (e) { e.preventDefault() $(this).tab('show') }) @@ -50,10 +50,10 @@ $('#myTab a').click(function (e) { <p>You can activate individual tabs in several ways:</p> {% highlight js %} -$('#myTab a[href="#profile"]').tab('show') // Select tab by name -$('#myTab a:first').tab('show') // Select first tab -$('#myTab a:last').tab('show') // Select last tab -$('#myTab li:eq(2) a').tab('show') // Select third tab (0-indexed) +$('#myTabs a[href="#profile"]').tab('show') // Select tab by name +$('#myTabs a:first').tab('show') // Select first tab +$('#myTabs a:last').tab('show') // Select last tab +$('#myTabs li:eq(2) a').tab('show') // Select third tab (0-indexed) {% endhighlight %} <h3>Markup</h3> @@ -94,29 +94,12 @@ $('#myTab li:eq(2) a').tab('show') // Select third tab (0-indexed) <h3 id="tabs-methods">Methods</h3> <h4><code>$().tab</code></h4> <p> - Activates a tab element and content container. Tab should have either a <code>data-target</code> or an <code>href</code> targeting a container node in the DOM. + Activates a tab element and content container. Tab should have either a <code>data-target</code> or an <code>href</code> targeting a container node in the DOM. In the above examples, the tabs are the <code><a></code>s with <code>data-toggle="tab"</code> attributes. </p> -{% highlight html %} -<ul class="nav nav-tabs" role="tablist" id="myTab"> - <li role="presentation" class="active"><a href="#home" aria-controls="home" role="tab" data-toggle="tab">Home</a></li> - <li role="presentation"><a href="#profile" aria-controls="profile" role="tab" data-toggle="tab">Profile</a></li> - <li role="presentation"><a href="#messages" aria-controls="messages" role="tab" data-toggle="tab">Messages</a></li> - <li role="presentation"><a href="#settings" aria-controls="settings" role="tab" data-toggle="tab">Settings</a></li> -</ul> -<div class="tab-content"> - <div role="tabpanel" class="tab-pane active" id="home">...</div> - <div role="tabpanel" class="tab-pane" id="profile">...</div> - <div role="tabpanel" class="tab-pane" id="messages">...</div> - <div role="tabpanel" class="tab-pane" id="settings">...</div> -</div> - -<script> - $(function () { - $('#myTab a:last').tab('show') - }) -</script> -{% endhighlight %} + <h4><code>.tab('show')</code></h4> + <p>Selects the given tab and shows its associated content. Any other tab that was previously selected becomes unselected and its associated content is hidden.</p> + {% highlight js %}$('#someTab').tab('show'){% endhighlight %} <h3 id="tabs-events">Events</h3> <p>When showing a new tab, the events fire in the following order:</p> |
