2
0
mirror of https://github.com/tenrok/bootstrap.git synced 2026-06-11 18:02:28 +03:00

docs: switch to fenced codeblocks (#31806)

This commit is contained in:
XhmikosR
2020-10-19 12:56:49 +03:00
committed by GitHub
parent 48177c946f
commit e6618a6ebb
43 changed files with 494 additions and 446 deletions
+10 -10
View File
@@ -80,18 +80,18 @@ When an alert is dismissed, the element is completely removed from the page stru
Enable dismissal of an alert via JavaScript:
{{< highlight js >}}
```js
var alertList = document.querySelectorAll('.alert')
alertList.forEach(function (alert) {
new bootstrap.Alert(alert)
})
{{< /highlight >}}
```
Or with `data` attributes on a button **within the alert**, as demonstrated above:
{{< highlight html >}}
```html
<button type="button" class="btn-close" data-dismiss="alert" aria-label="Close"></button>
{{< /highlight >}}
```
Note that closing an alert will remove it from the DOM.
@@ -99,10 +99,10 @@ Note that closing an alert will remove it from the DOM.
You can create an alert instance with the alert constructor, for example:
{{< highlight js >}}
```js
var myAlert = document.getElementById('myAlert')
var bsAlert = new bootstrap.Alert(myAlert)
{{< /highlight >}}
```
This makes an alert listen for click events on descendant elements which have the `data-dismiss="alert"` attribute. (Not necessary when using the data-api's auto-initialization.)
@@ -141,11 +141,11 @@ This makes an alert listen for click events on descendant elements which have th
</tbody>
</table>
{{< highlight js >}}
```js
var alertNode = document.querySelector('.alert')
var alert = bootstrap.Alert.getInstance(alertNode)
alert.close()
{{< /highlight >}}
```
### Events
@@ -174,11 +174,11 @@ Bootstrap's alert plugin exposes a few events for hooking into alert functionali
</tbody>
</table>
{{< highlight js >}}
```js
var myAlert = document.getElementById('myAlert')
myAlert.addEventListener('closed.bs.alert', function () {
// do something, for instance, explicitly move focus to the most appropriate element,
// so it doesn't get lost/reset to the start of the page
// document.getElementById('...').focus()
})
{{< /highlight >}}
```
@@ -163,11 +163,11 @@ Instead of applying button sizing classes to every button in a group, just add `
</div>
</div>
{{< highlight html >}}
```html
<div class="btn-group btn-group-lg" role="group" aria-label="...">...</div>
<div class="btn-group" role="group" aria-label="...">...</div>
<div class="btn-group btn-group-sm" role="group" aria-label="...">...</div>
{{< /highlight >}}
```
## Nesting
@@ -261,8 +261,8 @@ Make a set of buttons appear vertically stacked rather than horizontally. **Spli
</div>
</div>
{{< highlight html >}}
```html
<div class="btn-group-vertical">
...
</div>
{{< /highlight >}}
```
+4 -4
View File
@@ -129,10 +129,10 @@ Add `data-toggle="button"` to toggle a button's `active` state. If you're pre-to
You can create a button instance with the button constructor, for example:
{{< highlight js >}}
```js
var button = document.getElementById('myButton')
var bsButton = new bootstrap.Button(button)
{{< /highlight >}}
```
<table class="table">
<thead>
@@ -163,10 +163,10 @@ var bsButton = new bootstrap.Button(button)
For example, to toggle all buttons
{{< highlight js >}}
```js
var buttons = document.querySelectorAll('.btn')
buttons.forEach(function (button) {
var button = new bootstrap.Button(button)
button.toggle()
})
{{< /highlight >}}
```
+6 -6
View File
@@ -263,10 +263,10 @@ The `data-ride="carousel"` attribute is used to mark a carousel as animating sta
Call carousel manually with:
{{< highlight js >}}
```js
var myCarousel = document.querySelector('#myCarousel')
var carousel = new bootstrap.Carousel(myCarousel)
{{< /highlight >}}
```
### Options
@@ -330,13 +330,13 @@ Options can be passed via data attributes or JavaScript. For data attributes, ap
You can create a carousel instance with the carousel constructor, for example, to initialize with additional options and start cycling through items:
{{< highlight js >}}
```js
var myCarousel = document.querySelector('#myCarousel')
var carousel = new bootstrap.Carousel(myCarousel, {
interval: 2000,
wrap: false
})
{{< /highlight >}}
```
<table class="table">
<thead>
@@ -411,13 +411,13 @@ All carousel events are fired at the carousel itself (i.e. at the `<div class="c
</tbody>
</table>
{{< highlight js >}}
```js
var myCarousel = document.getElementById('myCarousel')
myCarousel.addEventListener('slide.bs.carousel', function () {
// do something...
})
{{< /highlight >}}
```
### Change transition duration
+6 -6
View File
@@ -149,12 +149,12 @@ To add accordion-like group management to a collapsible area, add the data attri
Enable manually with:
{{< highlight js >}}
```js
var collapseElementList = [].slice.call(document.querySelectorAll('.collapse'))
var collapseList = collapseElementList.map(function (collapseEl) {
return new bootstrap.Collapse(collapseEl)
})
{{< /highlight >}}
```
### Options
@@ -195,12 +195,12 @@ Activates your content as a collapsible element. Accepts an optional options `ob
You can create a collapse instance with the constructor, for example:
{{< highlight js >}}
```js
var myCollapse = document.getElementById('myCollapse')
var bsCollapse = new bootstrap.Collapse(myCollapse, {
toggle: false
})
{{< /highlight >}}
```
<table class="table">
<thead>
@@ -264,9 +264,9 @@ Bootstrap's collapse class exposes a few events for hooking into collapse functi
</tbody>
</table>
{{< highlight js >}}
```js
var myCollapsible = document.getElementById('myCollapsible')
myCollapsible.addEventListener('hidden.bs.collapse', function () {
// do something...
})
{{< /highlight >}}
```
+20 -20
View File
@@ -122,7 +122,7 @@ The best part is you can do this with any button variant, too:
</div><!-- /btn-group -->
</div>
{{< highlight html >}}
```html
<!-- Example single danger button -->
<div class="btn-group">
<button type="button" class="btn btn-danger dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
@@ -136,7 +136,7 @@ The best part is you can do this with any button variant, too:
<li><a class="dropdown-item" href="#">Separated link</a></li>
</ul>
</div>
{{< /highlight >}}
```
### Split button
@@ -225,7 +225,7 @@ We use this extra class to reduce the horizontal `padding` on either side of the
</div><!-- /btn-group -->
</div>
{{< highlight html >}}
```html
<!-- Example split danger button -->
<div class="btn-group">
<button type="button" class="btn btn-danger">Action</button>
@@ -240,7 +240,7 @@ We use this extra class to reduce the horizontal `padding` on either side of the
<li><a class="dropdown-item" href="#">Separated link</a></li>
</ul>
</div>
{{< /highlight >}}
```
## Sizing
@@ -274,7 +274,7 @@ Button dropdowns work with buttons of all sizes, including default and split dro
</div>
</div>
{{< highlight html >}}
```html
<!-- Large button groups (default and split) -->
<div class="btn-group">
<button class="btn btn-secondary btn-lg dropdown-toggle" type="button" data-toggle="dropdown" aria-expanded="false">
@@ -295,7 +295,7 @@ Button dropdowns work with buttons of all sizes, including default and split dro
...
</ul>
</div>
{{< /highlight >}}
```
<div class="bd-example">
<div class="btn-group">
@@ -325,7 +325,7 @@ Button dropdowns work with buttons of all sizes, including default and split dro
</div>
</div>
{{< highlight html >}}
```
<div class="btn-group">
<button class="btn btn-secondary btn-sm dropdown-toggle" type="button" data-toggle="dropdown" aria-expanded="false">
Small button
@@ -345,7 +345,7 @@ Button dropdowns work with buttons of all sizes, including default and split dro
...
</ul>
</div>
{{< /highlight >}}
```
## Dark dropdowns
@@ -429,7 +429,7 @@ Trigger dropdown menus above elements by adding `.dropup` to the parent element.
</div>
</div>
{{< highlight html >}}
```html
<!-- Default dropup button -->
<div class="btn-group dropup">
<button type="button" class="btn btn-secondary dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
@@ -452,7 +452,7 @@ Trigger dropdown menus above elements by adding `.dropup` to the parent element.
<!-- Dropdown menu links -->
</ul>
</div>
{{< /highlight >}}
```
### Dropright
@@ -488,7 +488,7 @@ Trigger dropdown menus at the right of the elements by adding `.dropright` to th
</div>
</div>
{{< highlight html >}}
```html
<!-- Default dropright button -->
<div class="btn-group dropright">
<button type="button" class="btn btn-secondary dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
@@ -511,7 +511,7 @@ Trigger dropdown menus at the right of the elements by adding `.dropright` to th
<!-- Dropdown menu links -->
</ul>
</div>
{{< /highlight >}}
```
### Dropleft
@@ -549,7 +549,7 @@ Trigger dropdown menus at the left of the elements by adding `.dropleft` to the
</div>
</div>
{{< highlight html >}}
```html
<!-- Default dropleft button -->
<div class="btn-group dropleft">
<button type="button" class="btn btn-secondary dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
@@ -574,7 +574,7 @@ Trigger dropdown menus at the left of the elements by adding `.dropleft` to the
Split dropleft
</button>
</div>
{{< /highlight >}}
```
## Menu items
@@ -825,7 +825,7 @@ On touch-enabled devices, opening a dropdown adds empty `mouseover` handlers to
Add `data-toggle="dropdown"` to a link or button to toggle a dropdown.
{{< highlight html >}}
```html
<div class="dropdown">
<button id="dLabel" type="button" data-toggle="dropdown" aria-expanded="false">
Dropdown trigger
@@ -834,18 +834,18 @@ Add `data-toggle="dropdown"` to a link or button to toggle a dropdown.
...
</ul>
</div>
{{< /highlight >}}
```
### Via JavaScript
Call the dropdowns via JavaScript:
{{< highlight js >}}
```js
var dropdownElementList = [].slice.call(document.querySelectorAll('.dropdown-toggle'))
var dropdownList = dropdownElementList.map(function (dropdownToggleEl) {
return new bootstrap.Dropdown(dropdownToggleEl)
})
{{< /highlight >}}
```
{{< callout info >}}
##### `data-toggle="dropdown"` still required
@@ -1009,9 +1009,9 @@ All dropdown events are fired at the `.dropdown-menu`'s parent element and have
</tbody>
</table>
{{< highlight js >}}
```js
var myDropdown = document.getElementById('myDropdown')
myDropdown.addEventListener('show.bs.dropdown', function () {
// do something...
})
{{< /highlight >}}
```
+18 -18
View File
@@ -288,7 +288,7 @@ Use the tab JavaScript plugin—include it individually or through the compiled
</div>
</div>
{{< highlight html >}}
```html
<div class="row">
<div class="col-4">
<div class="list-group" id="list-tab" role="tablist">
@@ -307,14 +307,14 @@ Use the tab JavaScript plugin—include it individually or through the compiled
</div>
</div>
</div>
{{< /highlight >}}
```
### Using data attributes
You can activate a list group navigation without writing any JavaScript by simply specifying `data-toggle="list"` or on an element. Use these data attributes on `.list-group-item`.
<div role="tabpanel">
{{< highlight html >}}
```html
<!-- List group -->
<div class="list-group" id="myList" role="tablist">
<a class="list-group-item list-group-item-action active" data-toggle="list" href="#home" role="tab">Home</a>
@@ -330,14 +330,14 @@ You can activate a list group navigation without writing any JavaScript by simpl
<div class="tab-pane" id="messages" role="tabpanel">...</div>
<div class="tab-pane" id="settings" role="tabpanel">...</div>
</div>
{{< /highlight >}}
```
</div>
### Via JavaScript
Enable tabbable list item via JavaScript (each list item needs to be activated individually):
{{< highlight js >}}
```js
var triggerTabList = [].slice.call(document.querySelectorAll('#myTab a'))
triggerTabList.forEach(function (triggerEl) {
var tabTrigger = new bootstrap.Tab(triggerEl)
@@ -347,30 +347,30 @@ triggerTabList.forEach(function (triggerEl) {
tabTrigger.show()
})
})
{{< /highlight >}}
```
You can activate individual list item in several ways:
{{< highlight js >}}
```js
var triggerEl = document.querySelector('#myTab a[href="#profile"]')
bootstrap.Tab.getInstance(triggerEl).show() // Select tab by name
var triggerFirstTabEl = document.querySelector('#myTab li:first-child a')
bootstrap.Tab.getInstance(triggerFirstTabEl).show() // Select first tab
{{< /highlight >}}
```
### Fade effect
To make tabs panel fade in, add `.fade` to each `.tab-pane`. The first tab pane must also have `.show` to make the initial content visible.
{{< highlight html >}}
```html
<div class="tab-content">
<div class="tab-pane fade show active" id="home" role="tabpanel">...</div>
<div class="tab-pane fade" id="profile" role="tabpanel">...</div>
<div class="tab-pane fade" id="messages" role="tabpanel">...</div>
<div class="tab-pane fade" id="settings" role="tabpanel">...</div>
</div>
{{< /highlight >}}
```
### Methods
@@ -378,7 +378,7 @@ To make tabs panel fade in, add `.fade` to each `.tab-pane`. The first tab pane
Activates a list item element and content container. Tab should have either a `data-target` or an `href` targeting a container node in the DOM.
{{< highlight html >}}
```html
<div class="list-group" id="myList" role="tablist">
<a class="list-group-item list-group-item-action active" data-toggle="list" href="#home" role="tab">Home</a>
<a class="list-group-item list-group-item-action" data-toggle="list" href="#profile" role="tab">Profile</a>
@@ -399,18 +399,18 @@ Activates a list item element and content container. Tab should have either a `d
firstTab.show()
</script>
{{< /highlight >}}
```
#### show
Selects the given list item and shows its associated pane. Any other list item that was previously selected becomes unselected and its associated pane is hidden. **Returns to the caller before the tab pane has actually been shown** (for example, before the `shown.bs.tab` event occurs).
{{< highlight js >}}
```js
var someListItemEl = document.querySelector('#someListItem')
var tab = new bootstrap.Tab(someListItemEl)
tab.show()
{{< /highlight >}}
```
#### dispose
@@ -420,10 +420,10 @@ Destroys an element's tab.
*Static* method which allows you to get the tab instance associated with a DOM element
{{< highlight js >}}
```js
var triggerEl = document.querySelector('#trigger')
var tab = bootstrap.Tab.getInstance(triggerEl) // Returns a Bootstrap tab instance
{{< /highlight >}}
```
### Events
@@ -463,10 +463,10 @@ If no tab was already active, the `hide.bs.tab` and `hidden.bs.tab` events will
</tbody>
</table>
{{< highlight js >}}
```js
var tabEl = document.querySelector('a[data-toggle="list"]')
tabEl.addEventListener('shown.bs.tab', function (e) {
e.target // newly activated tab
e.relatedTarget // previous active tab
})
{{< /highlight >}}
```
+49 -39
View File
@@ -17,14 +17,14 @@ Before getting started with Bootstrap's modal component, be sure to read the fol
- Once again, due to `position: fixed`, there are some caveats with using modals on mobile devices. [See our browser support docs]({{< docsref "/getting-started/browsers-devices#modals-and-dropdowns-on-mobile" >}}) for details.
- Due to how HTML5 defines its semantics, [the `autofocus` HTML attribute](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#attr-autofocus) has no effect in Bootstrap modals. To achieve the same effect, use some custom JavaScript:
{{< highlight js >}}
```js
var myModal = document.getElementById('myModal')
var myInput = document.getElementById('myInput')
myModal.addEventListener('shown.bs.modal', function () {
myInput.focus()
})
{{< /highlight >}}
```
{{< callout info >}}
{{< partial "callout-info-prefersreducedmotion.md" >}}
@@ -58,7 +58,7 @@ Below is a _static_ modal example (meaning its `position` and `display` have bee
</div>
</div>
{{< highlight html >}}
```html
<div class="modal" tabindex="-1">
<div class="modal-dialog">
<div class="modal-content">
@@ -76,7 +76,7 @@ Below is a _static_ modal example (meaning its `position` and `display` have bee
</div>
</div>
</div>
{{< /highlight >}}
```
### Live demo
@@ -106,7 +106,7 @@ Toggle a working modal demo by clicking the button below. It will slide down and
</button>
</div>
{{< highlight html >}}
```html
<!-- Button trigger modal -->
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#exampleModal">
Launch demo modal
@@ -130,7 +130,7 @@ Toggle a working modal demo by clicking the button below. It will slide down and
</div>
</div>
</div>
{{< /highlight >}}
```
### Static backdrop
@@ -160,7 +160,7 @@ When backdrop is set to static, the modal will not close when clicking outside i
</button>
</div>
{{< highlight html >}}
```html
<!-- Button trigger modal -->
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#staticBackdrop">
Launch static backdrop modal
@@ -184,7 +184,7 @@ When backdrop is set to static, the modal will not close when clicking outside i
</div>
</div>
</div>
{{< /highlight >}}
```
### Scrolling long content
@@ -275,12 +275,12 @@ You can also create a scrollable modal that allows scroll the modal body by addi
</button>
</div>
{{< highlight html >}}
```html
<!-- Scrollable modal -->
<div class="modal-dialog modal-dialog-scrollable">
...
</div>
{{< /highlight >}}
```
### Vertically centered
@@ -335,7 +335,7 @@ Add `.modal-dialog-centered` to `.modal-dialog` to vertically center the modal.
</button>
</div>
{{< highlight html >}}
```html
<!-- Vertically centered modal -->
<div class="modal-dialog modal-dialog-centered">
...
@@ -345,7 +345,7 @@ Add `.modal-dialog-centered` to `.modal-dialog` to vertically center the modal.
<div class="modal-dialog modal-dialog-centered modal-dialog-scrollable">
...
</div>
{{< /highlight >}}
```
### Tooltips and popovers
@@ -379,7 +379,7 @@ Add `.modal-dialog-centered` to `.modal-dialog` to vertically center the modal.
</button>
</div>
{{< highlight html >}}
```html
<div class="modal-body">
<h5>Popover in a modal</h5>
<p>This <a href="#" role="button" class="btn btn-secondary popover-test" title="Popover title" data-content="Popover body content is set in this attribute.">button</a> triggers a popover on click.</p>
@@ -387,7 +387,7 @@ Add `.modal-dialog-centered` to `.modal-dialog` to vertically center the modal.
<h5>Tooltips in a modal</h5>
<p><a href="#" class="tooltip-test" title="Tooltip">This link</a> and <a href="#" class="tooltip-test" title="Tooltip">that link</a> have tooltips on hover.</p>
</div>
{{< /highlight >}}
```
### Using the grid
@@ -442,7 +442,7 @@ Utilize the Bootstrap grid system within a modal by nesting `.container-fluid` w
</button>
</div>
{{< highlight html >}}
```html
<div class="modal-body">
<div class="container-fluid">
<div class="row">
@@ -471,7 +471,7 @@ Utilize the Bootstrap grid system within a modal by nesting `.container-fluid` w
</div>
</div>
</div>
{{< /highlight >}}
```
### Varying modal content
@@ -512,7 +512,7 @@ Below is a live demo followed by example HTML and JavaScript. For more informati
</div>
{{< /example >}}
{{< highlight js >}}
```js
var exampleModal = document.getElementById('exampleModal')
exampleModal.addEventListener('show.bs.modal', function (event) {
// Button that triggered the modal
@@ -529,7 +529,7 @@ exampleModal.addEventListener('show.bs.modal', function (event) {
modalTitle.textContent = 'New message to ' + recipient
modalBodyInput.value = recipient
})
{{< /highlight >}}
```
### Change animation
@@ -541,11 +541,11 @@ If you want for example a zoom-in animation, you can set `$modal-fade-transform:
For modals that simply appear rather than fade in to view, remove the `.fade` class from your modal markup.
{{< highlight html >}}
```html
<div class="modal" tabindex="-1" aria-labelledby="..." aria-hidden="true">
...
</div>
{{< /highlight >}}
```
### Dynamic heights
@@ -603,11 +603,11 @@ Our default modal without modifier class constitutes the "medium" size modal.
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#exampleModalSm">Small modal</button>
</div>
{{< highlight html >}}
```html
<div class="modal-dialog modal-xl">...</div>
<div class="modal-dialog modal-lg">...</div>
<div class="modal-dialog modal-sm">...</div>
{{< /highlight >}}
```
<div class="modal fade" id="exampleModalXl" tabindex="-1" aria-labelledby="exampleModalXlLabel" aria-hidden="true">
<div class="modal-dialog modal-xl">
@@ -699,12 +699,12 @@ Another override is the option to pop up a modal that covers the user viewport,
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#exampleModalFullscreenXxl">Full screen below xxl</button>
</div>
{{< highlight html >}}
```html
<!-- Full screen modal -->
<div class="modal-dialog modal-fullscreen-sm-down">
...
</div>
{{< /highlight >}}
```
<div class="modal fade" id="exampleModalFullscreen" tabindex="-1" aria-labelledby="exampleModalFullscreenLabel" aria-hidden="true">
<div class="modal-dialog modal-fullscreen">
@@ -833,17 +833,17 @@ The modal plugin toggles your hidden content on demand, via data attributes or J
Activate a modal without writing JavaScript. Set `data-toggle="modal"` on a controller element, like a button, along with a `data-target="#foo"` or `href="#foo"` to target a specific modal to toggle.
{{< highlight html >}}
```html
<button type="button" data-toggle="modal" data-target="#myModal">Launch modal</button>
{{< /highlight >}}
```
### Via JavaScript
Create a modal with a single line of JavaScript:
{{< highlight js >}}
```js
var myModal = new bootstrap.Modal(document.getElementById('myModal'), options)
{{< /highlight >}}
```
### Options
@@ -896,50 +896,60 @@ Options can be passed via data attributes or JavaScript. For data attributes, ap
Activates your content as a modal. Accepts an optional options `object`.
{{< highlight js >}}
```js
var myModal = new bootstrap.Modal(document.getElementById('myModal'), {
keyboard: false
})
{{< /highlight >}}
```
#### toggle
Manually toggles a modal. **Returns to the caller before the modal has actually been shown or hidden** (i.e. before the `shown.bs.modal` or `hidden.bs.modal` event occurs).
{{< highlight js >}}myModal.toggle(){{< /highlight >}}
```js
myModal.toggle()
```
#### show
Manually opens a modal. **Returns to the caller before the modal has actually been shown** (i.e. before the `shown.bs.modal` event occurs).
{{< highlight js >}}myModal.show(){{< /highlight >}}
```js
myModal.show()
```
#### hide
Manually hides a modal. **Returns to the caller before the modal has actually been hidden** (i.e. before the `hidden.bs.modal` event occurs).
{{< highlight js >}}myModal.hide(){{< /highlight >}}
```js
myModal.hide()
```
#### handleUpdate
Manually readjust the modal's position if the height of a modal changes while it is open (i.e. in case a scrollbar appears).
{{< highlight js >}}myModal.handleUpdate(){{< /highlight >}}
```js
myModal.handleUpdate()
```
#### dispose
Destroys an element's modal. (Removes stored data on the DOM element)
{{< highlight js >}}myModal.dispose(){{< /highlight >}}
```js
myModal.dispose()
```
#### getInstance
*Static* method which allows you to get the modal instance associated with a DOM element
{{< highlight js >}}
```js
var myModalEl = document.getElementById('myModal')
var modal = bootstrap.Modal.getInstance(myModalEl) // Returns a Bootstrap modal instance
{{< /highlight >}}
```
### Events
@@ -976,9 +986,9 @@ Bootstrap's modal class exposes a few events for hooking into modal functionalit
</tbody>
</table>
{{< highlight js >}}
```js
var myModalEl = document.getElementById('myModal')
myModalEl.addEventListener('hidden.bs.modal', function (e) {
// do something...
})
{{< /highlight >}}
```
+2 -2
View File
@@ -403,7 +403,7 @@ Theming the navbar has never been easier thanks to the combination of theming cl
</nav>
</div>
{{< highlight html >}}
```html
<nav class="navbar navbar-dark bg-dark">
<!-- Navbar content -->
</nav>
@@ -415,7 +415,7 @@ Theming the navbar has never been easier thanks to the combination of theming cl
<nav class="navbar navbar-light" style="background-color: #e3f2fd;">
<!-- Navbar content -->
</nav>
{{< /highlight >}}
```
## Containers
+24 -24
View File
@@ -336,7 +336,7 @@ Note that dynamic tabbed interfaces should <em>not</em> contain dropdown menus,
</div>
</div>
{{< highlight html >}}
```html
<ul class="nav nav-tabs" id="myTab" role="tablist">
<li class="nav-item" role="presentation">
<a class="nav-link active" id="home-tab" data-toggle="tab" href="#home" role="tab" aria-controls="home" aria-selected="true">Home</a>
@@ -353,7 +353,7 @@ Note that dynamic tabbed interfaces should <em>not</em> contain dropdown menus,
<div class="tab-pane fade" id="profile" role="tabpanel" aria-labelledby="profile-tab">...</div>
<div class="tab-pane fade" id="contact" role="tabpanel" aria-labelledby="contact-tab">...</div>
</div>
{{< /highlight >}}
```
To help fit your needs, this works with `<ul>`-based markup, as shown above, or with any arbitrary "roll your own" markup. Note that if you're using `<nav>`, you shouldn't add `role="tablist"` directly to it, as this would override the element's native role as a navigation landmark. Instead, switch to an alternative element (in the example below, a simple `<div>`) and wrap the `<nav>` around it.
@@ -378,7 +378,7 @@ To help fit your needs, this works with `<ul>`-based markup, as shown above, or
</div>
</div>
{{< highlight html >}}
```html
<nav>
<div class="nav nav-tabs" id="nav-tab" role="tablist">
<a class="nav-link active" id="nav-home-tab" data-toggle="tab" href="#nav-home" role="tab" aria-controls="nav-home" aria-selected="true">Home</a>
@@ -391,7 +391,7 @@ To help fit your needs, this works with `<ul>`-based markup, as shown above, or
<div class="tab-pane fade" id="nav-profile" role="tabpanel" aria-labelledby="nav-profile-tab">...</div>
<div class="tab-pane fade" id="nav-contact" role="tabpanel" aria-labelledby="nav-contact-tab">...</div>
</div>
{{< /highlight >}}
```
The tabs plugin also works with pills.
@@ -420,7 +420,7 @@ The tabs plugin also works with pills.
</div>
</div>
{{< highlight html >}}
```html
<ul class="nav nav-pills mb-3" id="pills-tab" role="tablist">
<li class="nav-item" role="presentation">
<a class="nav-link active" id="pills-home-tab" data-toggle="pill" href="#pills-home" role="tab" aria-controls="pills-home" aria-selected="true">Home</a>
@@ -437,7 +437,7 @@ The tabs plugin also works with pills.
<div class="tab-pane fade" id="pills-profile" role="tabpanel" aria-labelledby="pills-profile-tab">...</div>
<div class="tab-pane fade" id="pills-contact" role="tabpanel" aria-labelledby="pills-contact-tab">...</div>
</div>
{{< /highlight >}}
```
And with vertical pills.
@@ -466,7 +466,7 @@ And with vertical pills.
</div>
</div>
{{< highlight html >}}
```html
<div class="d-flex align-items-start">
<div class="nav flex-column nav-pills mr-3" id="v-pills-tab" role="tablist" aria-orientation="vertical">
<a class="nav-link active" id="v-pills-home-tab" data-toggle="pill" href="#v-pills-home" role="tab" aria-controls="v-pills-home" aria-selected="true">Home</a>
@@ -481,13 +481,13 @@ And with vertical pills.
<div class="tab-pane fade" id="v-pills-settings" role="tabpanel" aria-labelledby="v-pills-settings-tab">...</div>
</div>
</div>
{{< /highlight >}}
```
### Using data attributes
You can activate a tab or pill navigation without writing any JavaScript by simply specifying `data-toggle="tab"` or `data-toggle="pill"` on an element. Use these data attributes on `.nav-tabs` or `.nav-pills`.
{{< highlight html >}}
```html
<!-- Nav tabs -->
<ul class="nav nav-tabs" id="myTab" role="tablist">
<li class="nav-item" role="presentation">
@@ -511,13 +511,13 @@ You can activate a tab or pill navigation without writing any JavaScript by simp
<div class="tab-pane" id="messages" role="tabpanel" aria-labelledby="messages-tab">...</div>
<div class="tab-pane" id="settings" role="tabpanel" aria-labelledby="settings-tab">...</div>
</div>
{{< /highlight >}}
```
### Via JavaScript
Enable tabbable tabs via JavaScript (each tab needs to be activated individually):
{{< highlight js >}}
```js
var triggerTabList = [].slice.call(document.querySelectorAll('#myTab a'))
triggerTabList.forEach(function (triggerEl) {
var tabTrigger = new bootstrap.Tab(triggerEl)
@@ -527,30 +527,30 @@ triggerTabList.forEach(function (triggerEl) {
tabTrigger.show()
})
})
{{< /highlight >}}
```
You can activate individual tabs in several ways:
{{< highlight js >}}
```js
var triggerEl = document.querySelector('#myTab a[href="#profile"]')
bootstrap.Tab.getInstance(triggerEl).show() // Select tab by name
var triggerFirstTabEl = document.querySelector('#myTab li:first-child a')
bootstrap.Tab.getInstance(triggerFirstTabEl).show() // Select first tab
{{< /highlight >}}
```
### Fade effect
To make tabs fade in, add `.fade` to each `.tab-pane`. The first tab pane must also have `.show` to make the initial content visible.
{{< highlight html >}}
```html
<div class="tab-content">
<div class="tab-pane fade show active" id="home" role="tabpanel" aria-labelledby="home-tab">...</div>
<div class="tab-pane fade" id="profile" role="tabpanel" aria-labelledby="profile-tab">...</div>
<div class="tab-pane fade" id="messages" role="tabpanel" aria-labelledby="messages-tab">...</div>
<div class="tab-pane fade" id="settings" role="tabpanel" aria-labelledby="settings-tab">...</div>
</div>
{{< /highlight >}}
```
### Methods
@@ -562,7 +562,7 @@ To make tabs fade in, add `.fade` to each `.tab-pane`. The first tab pane must a
Activates a tab element and content container. Tab should have either a `data-target` or an `href` targeting a container node in the DOM.
{{< highlight html >}}
```html
<ul class="nav nav-tabs" id="myTab" role="tablist">
<li class="nav-item" role="presentation">
<a class="nav-link active" id="home-tab" data-toggle="tab" href="#home" role="tab" aria-controls="home" aria-selected="true">Home</a>
@@ -591,18 +591,18 @@ Activates a tab element and content container. Tab should have either a `data-ta
firstTab.show()
</script>
{{< /highlight >}}
```
#### show
Selects the given tab and shows its associated pane. Any other tab that was previously selected becomes unselected and its associated pane is hidden. **Returns to the caller before the tab pane has actually been shown** (i.e. before the `shown.bs.tab` event occurs).
{{< highlight js >}}
```js
var someTabTriggerEl = document.querySelector('#someTabTrigger')
var tab = new bootstrap.Tab(someTabTriggerEl)
tab.show()
{{< /highlight >}}
```
#### dispose
@@ -612,10 +612,10 @@ Destroys an element's tab.
*Static* method which allows you to get the tab instance associated with a DOM element
{{< highlight js >}}
```js
var triggerEl = document.querySelector('#trigger')
var tab = bootstrap.Tab.getInstance(triggerEl) // Returns a Bootstrap tab instance
{{< /highlight >}}
```
### Events
@@ -655,10 +655,10 @@ If no tab was already active, then the `hide.bs.tab` and `hidden.bs.tab` events
</tbody>
</table>
{{< highlight js >}}
```js
var tabEl = document.querySelector('a[data-toggle="tab"]')
tabEl.addEventListener('shown.bs.tab', function (e) {
e.target // newly activated tab
e.relatedTarget // previous active tab
})
{{< /highlight >}}
```
+38 -22
View File
@@ -31,22 +31,22 @@ Keep reading to see how popovers work with some examples.
One way to initialize all popovers on a page would be to select them by their `data-toggle` attribute:
{{< highlight js >}}
```js
var popoverTriggerList = [].slice.call(document.querySelectorAll('[data-toggle="popover"]'))
var popoverList = popoverTriggerList.map(function (popoverTriggerEl) {
return new bootstrap.Popover(popoverTriggerEl)
})
{{< /highlight >}}
```
## Example: Using the `container` option
When you have some styles on a parent element that interfere with a popover, you'll want to specify a custom `container` so that the popover's HTML appears within that element instead.
{{< highlight js >}}
```js
var popover = new bootstrap.Popover(document.querySelector('.example-popover'), {
container: 'body'
})
{{< /highlight >}}
```
## Example
@@ -75,7 +75,7 @@ Four options are available: top, right, bottom, and left aligned.
</div>
</div>
{{< highlight html >}}
```html
<button type="button" class="btn btn-secondary" data-container="body" data-toggle="popover" data-placement="top" data-content="Vivamus sagittis lacus vel augue laoreet rutrum faucibus.">
Popover on top
</button>
@@ -92,7 +92,7 @@ sagittis lacus vel augue laoreet rutrum faucibus.">
<button type="button" class="btn btn-secondary" data-container="body" data-toggle="popover" data-placement="left" data-content="Vivamus sagittis lacus vel augue laoreet rutrum faucibus.">
Popover on left
</button>
{{< /highlight >}}
```
### Dismiss on next click
@@ -108,11 +108,11 @@ For proper cross-browser and cross-platform behavior, you must use the `<a>` tag
<a tabindex="0" class="btn btn-lg btn-danger" role="button" data-toggle="popover" data-trigger="focus" title="Dismissible popover" data-content="And here's some amazing content. It's very engaging. Right?">Dismissible popover</a>
{{< /example >}}
{{< highlight js >}}
```js
var popover = new bootstrap.Popover(document.querySelector('.popover-dismiss'), {
trigger: 'focus'
})
{{< /highlight >}}
```
### Disabled elements
@@ -130,10 +130,10 @@ For disabled popover triggers, you may also prefer `data-trigger="hover"` so tha
Enable popovers via JavaScript:
{{< highlight js >}}
```js
var exampleEl = document.getElementById('example')
var popover = new bootstrap.Popover(exampleEl, options)
{{< /highlight >}}
```
{{< callout warning >}}
### Making popovers work for keyboard and assistive technology users
@@ -307,58 +307,74 @@ Options for individual popovers can alternatively be specified through the use o
Reveals an element's popover. **Returns to the caller before the popover has actually been shown** (i.e. before the `shown.bs.popover` event occurs). This is considered a "manual" triggering of the popover. Popovers whose title and content are both zero-length are never displayed.
{{< highlight js >}}myPopover.show(){{< /highlight >}}
```js
myPopover.show()
```
#### hide
Hides an element's popover. **Returns to the caller before the popover has actually been hidden** (i.e. before the `hidden.bs.popover` event occurs). This is considered a "manual" triggering of the popover.
{{< highlight js >}}myPopover.hide(){{< /highlight >}}
```js
myPopover.hide()
```
#### toggle
Toggles an element's popover. **Returns to the caller before the popover has actually been shown or hidden** (i.e. before the `shown.bs.popover` or `hidden.bs.popover` event occurs). This is considered a "manual" triggering of the popover.
{{< highlight js >}}myPopover.toggle(){{< /highlight >}}
```js
myPopover.toggle()
```
#### dispose
Hides and destroys an element's popover (Removes stored data on the DOM element). Popovers that use delegation (which are created using [the `selector` option](#options)) cannot be individually destroyed on descendant trigger elements.
{{< highlight js >}}myPopover.dispose(){{< /highlight >}}
```js
myPopover.dispose()
```
#### enable
Gives an element's popover the ability to be shown. **Popovers are enabled by default.**
{{< highlight js >}}myPopover.enable(){{< /highlight >}}
```js
myPopover.enable()
```
#### disable
Removes the ability for an element's popover to be shown. The popover will only be able to be shown if it is re-enabled.
{{< highlight js >}}myPopover.disable(){{< /highlight >}}
```js
myPopover.disable()
```
#### toggleEnabled
Toggles the ability for an element's popover to be shown or hidden.
{{< highlight js >}}myPopover.toggleEnabled(){{< /highlight >}}
```js
myPopover.toggleEnabled()
```
#### update
Updates the position of an element's popover.
{{< highlight js >}}myPopover.update(){{< /highlight >}}
```js
myPopover.update()
```
#### getInstance
*Static* method which allows you to get the popover instance associated with a DOM element
{{< highlight js >}}
```js
var exampleTriggerEl = document.getElementById('example')
var popover = bootstrap.Popover.getInstance(exampleTriggerEl) // Returns a Bootstrap popover instance
{{< /highlight >}}
```
### Events
@@ -393,9 +409,9 @@ var popover = bootstrap.Popover.getInstance(exampleTriggerEl) // Returns a Boots
</tbody>
</table>
{{< highlight js >}}
```js
var myPopoverTrigger = document.getElementById('myPopover')
myPopoverTrigger.addEventListener('hidden.bs.popover', function () {
// do something...
})
{{< /highlight >}}
```
+2 -2
View File
@@ -132,8 +132,8 @@ The striped gradient can also be animated. Add `.progress-bar-animated` to `.pro
</button>
</div>
{{< highlight html >}}
```html
<div class="progress">
<div class="progress-bar progress-bar-striped progress-bar-animated" role="progressbar" aria-valuenow="75" aria-valuemin="0" aria-valuemax="100" style="width: 75%"></div>
</div>
{{< /highlight >}}
```
+18 -18
View File
@@ -63,7 +63,7 @@ Scroll the area below the navbar and watch the active class change. The dropdown
</div>
</div>
{{< highlight html >}}
```html
<nav id="navbar-example2" class="navbar navbar-light bg-light px-3">
<a class="navbar-brand" href="#">Navbar</a>
<ul class="nav nav-pills">
@@ -96,7 +96,7 @@ Scroll the area below the navbar and watch the active class change. The dropdown
<h4 id="three">three</h4>
<p>...</p>
</div>
{{< /highlight >}}
```
## Example with nested nav
@@ -143,7 +143,7 @@ Scrollspy also works with nested `.nav`s. If a nested `.nav` is `.active`, its p
</div>
</div>
{{< highlight html >}}
```html
<nav id="navbar-example3" class="navbar navbar-light bg-light">
<a class="navbar-brand" href="#">Navbar</a>
<nav class="nav nav-pills flex-column">
@@ -177,7 +177,7 @@ Scrollspy also works with nested `.nav`s. If a nested `.nav` is `.active`, its p
<h5 id="item-3-2">Item 3-2</h5>
<p>...</p>
</div>
{{< /highlight >}}
```
## Example with list-group
@@ -208,7 +208,7 @@ Scrollspy also works with `.list-group`s. Scroll the area next to the list group
</div>
</div>
{{< highlight html >}}
```html
<div id="list-example" class="list-group">
<a class="list-group-item list-group-item-action" href="#list-item-1">Item 1</a>
<a class="list-group-item list-group-item-action" href="#list-item-2">Item 2</a>
@@ -225,7 +225,7 @@ Scrollspy also works with `.list-group`s. Scroll the area next to the list group
<h4 id="list-item-4">Item 4</h4>
<p>...</p>
</div>
{{< /highlight >}}
```
## Usage
@@ -234,13 +234,13 @@ Scrollspy also works with `.list-group`s. Scroll the area next to the list group
To easily add scrollspy behavior to your topbar navigation, add `data-spy="scroll"` to the element you want to spy on (most typically this would be the `<body>`). Then add the `data-target` attribute with the ID or class of the parent element of any Bootstrap `.nav` component.
{{< highlight css >}}
```css
body {
position: relative;
}
{{< /highlight >}}
```
{{< highlight html >}}
```html
<body data-spy="scroll" data-target="#navbar-example">
...
<div id="navbar-example">
@@ -250,17 +250,17 @@ body {
</div>
...
</body>
{{< /highlight >}}
```
### Via JavaScript
After adding `position: relative;` in your CSS, call the scrollspy via JavaScript:
{{< highlight js >}}
```js
var scrollSpy = new bootstrap.ScrollSpy(document.body, {
target: '#navbar-example'
})
{{< /highlight >}}
```
{{< callout danger >}}
#### Resolvable ID targets required
@@ -280,13 +280,13 @@ Target elements that are not visible will be ignored and their corresponding nav
When using scrollspy in conjunction with adding or removing of elements from the DOM, you'll need to call the refresh method like so:
{{< highlight js >}}
```js
var dataSpyList = [].slice.call(document.querySelectorAll('[data-spy="scroll"]'))
dataSpyList.forEach(function (dataSpyEl) {
bootstrap.ScrollSpy.getInstance(dataSpyEl)
.refresh()
})
{{< /highlight >}}
```
#### dispose
@@ -296,10 +296,10 @@ Destroys an element's scrollspy. (Removes stored data on the DOM element)
*Static* method which allows you to get the scrollspy instance associated with a DOM element
{{< highlight js >}}
```js
var scrollSpyContentEl = document.getElementById('content')
var scrollSpy = bootstrap.ScrollSpy.getInstance(scrollSpyContentEl) // Returns a Bootstrap scrollspy instance
{{< /highlight >}}
```
### Options
@@ -353,9 +353,9 @@ Options can be passed via data attributes or JavaScript. For data attributes, ap
</tbody>
</table>
{{< highlight js >}}
```js
var firstScrollSpyEl = document.querySelector('[data-spy="scroll"]')
firstScrollSpyEl.addEventListener('activate.bs.scrollspy', function () {
// do something...
})
{{< /highlight >}}
```
+15 -9
View File
@@ -216,11 +216,11 @@ You also need to adapt the `role` and `aria-live` level depending on the content
As the content you're displaying changes, be sure to update the [`delay` timeout](#options) to ensure people have enough time to read the toast.
{{< highlight html >}}
```html
<div class="toast" role="alert" aria-live="polite" aria-atomic="true" data-delay="10000">
<div role="alert" aria-live="assertive" aria-atomic="true">...</div>
</div>
{{< /highlight >}}
```
When using `autohide: false`, you must add a close button to allow users to dismiss the toast.
@@ -244,12 +244,12 @@ When using `autohide: false`, you must add a close button to allow users to dism
Initialize toasts via JavaScript:
{{< highlight js >}}
```js
var toastElList = [].slice.call(document.querySelectorAll('.toast'))
var toastList = toastElList.map(function (toastEl) {
return new bootstrap.Toast(toastEl, option)
})
{{< /highlight >}}
```
### Options
@@ -299,19 +299,25 @@ Options can be passed via data attributes or JavaScript. For data attributes, ap
Reveals an element's toast. **Returns to the caller before the toast has actually been shown** (i.e. before the `shown.bs.toast` event occurs).
You have to manually call this method, instead your toast won't show.
{{< highlight js >}}toast.show(){{< /highlight >}}
```js
toast.show()
```
#### hide
Hides an element's toast. **Returns to the caller before the toast has actually been hidden** (i.e. before the `hidden.bs.toast` event occurs). You have to manually call this method if you made `autohide` to `false`.
{{< highlight js >}}toast.hide(){{< /highlight >}}
```js
toast.hide()
```
#### dispose
Hides an element's toast. Your toast will remain on the DOM but won't show anymore.
{{< highlight js >}}toast.dispose(){{< /highlight >}}
```js
toast.dispose()
```
### Events
@@ -342,9 +348,9 @@ Hides an element's toast. Your toast will remain on the DOM but won't show anymo
</tbody>
</table>
{{< highlight js >}}
```js
var myToastEl = document.getElementById('myToast')
myToastEl.addEventListener('hidden.bs.toast', function () {
// do something...
})
{{< /highlight >}}
```
+40 -24
View File
@@ -30,12 +30,12 @@ Got all that? Great, let's see how they work with some examples.
One way to initialize all tooltips on a page would be to select them by their `data-toggle` attribute:
{{< highlight js >}}
```js
var tooltipTriggerList = [].slice.call(document.querySelectorAll('[data-toggle="tooltip"]'))
var tooltipList = tooltipTriggerList.map(function (tooltipTriggerEl) {
return new bootstrap.Tooltip(tooltipTriggerEl)
})
{{< /highlight >}}
```
## Examples
@@ -58,7 +58,7 @@ Hover over the buttons below to see the four tooltips directions: top, right, bo
</div>
</div>
{{< highlight html >}}
```html
<button type="button" class="btn btn-secondary" data-toggle="tooltip" data-placement="top" title="Tooltip on top">
Tooltip on top
</button>
@@ -71,15 +71,15 @@ Hover over the buttons below to see the four tooltips directions: top, right, bo
<button type="button" class="btn btn-secondary" data-toggle="tooltip" data-placement="left" title="Tooltip on left">
Tooltip on left
</button>
{{< /highlight >}}
```
And with custom HTML added:
{{< highlight html >}}
```html
<button type="button" class="btn btn-secondary" data-toggle="tooltip" data-html="true" title="<em>Tooltip</em> <u>with</u> <b>HTML</b>">
Tooltip with HTML
</button>
{{< /highlight >}}
```
With an SVG:
@@ -98,22 +98,22 @@ The tooltip plugin generates content and markup on demand, and by default places
Trigger the tooltip via JavaScript:
{{< highlight js >}}
```js
var exampleEl = document.getElementById('example')
var tooltip = new bootstrap.Tooltip(exampleEl, options)
{{< /highlight >}}
```
{{< callout warning >}}
##### Overflow `auto` and `scroll`
Tooltip position attempts to automatically change when a parent container has `overflow: auto` or `overflow: scroll` like our `.table-responsive`, but still keeps the original placement's positioning. To resolve, set the `boundary` option to anything other than default value, `'scrollParent'`, such as `'window'`:
{{< highlight js >}}
```js
var exampleEl = document.getElementById('example')
var tooltip = new bootstrap.Tooltip(exampleEl, {
boundary: 'window'
})
{{< /highlight >}}
```
{{< /callout >}}
### Markup
@@ -126,7 +126,7 @@ The required markup for a tooltip is only a `data` attribute and `title` on the
You should only add tooltips to HTML elements that are traditionally keyboard-focusable and interactive (such as links or form controls). Although arbitrary HTML elements (such as `<span>`s) can be made focusable by adding the `tabindex="0"` attribute, this will add potentially annoying and confusing tab stops on non-interactive elements for keyboard users, and most assistive technologies currently do not announce the tooltip in this situation. Additionally, do not rely solely on `hover` as the trigger for your tooltip, as this will make your tooltips impossible to trigger for keyboard users.
{{< /callout >}}
{{< highlight html >}}
```html
<!-- HTML to write -->
<a href="#" data-toggle="tooltip" title="Some tooltip text!">Hover over me</a>
@@ -137,7 +137,7 @@ You should only add tooltips to HTML elements that are traditionally keyboard-fo
Some tooltip text!
</div>
</div>
{{< /highlight >}}
```
### Disabled elements
@@ -314,58 +314,74 @@ Options for individual tooltips can alternatively be specified through the use o
Reveals an element's tooltip. **Returns to the caller before the tooltip has actually been shown** (i.e. before the `shown.bs.tooltip` event occurs). This is considered a "manual" triggering of the tooltip. Tooltips with zero-length titles are never displayed.
{{< highlight js >}}tooltip.show(){{< /highlight >}}
```js
tooltip.show()
```
#### hide
Hides an element's tooltip. **Returns to the caller before the tooltip has actually been hidden** (i.e. before the `hidden.bs.tooltip` event occurs). This is considered a "manual" triggering of the tooltip.
{{< highlight js >}}tooltip.hide(){{< /highlight >}}
```js
tooltip.hide()
```
#### toggle
Toggles an element's tooltip. **Returns to the caller before the tooltip has actually been shown or hidden** (i.e. before the `shown.bs.tooltip` or `hidden.bs.tooltip` event occurs). This is considered a "manual" triggering of the tooltip.
{{< highlight js >}}tooltip.toggle(){{< /highlight >}}
```js
tooltip.toggle()
```
#### dispose
Hides and destroys an element's tooltip (Removes stored data on the DOM element). Tooltips that use delegation (which are created using [the `selector` option](#options)) cannot be individually destroyed on descendant trigger elements.
{{< highlight js >}}tooltip.dispose(){{< /highlight >}}
```js
tooltip.dispose()
```
#### enable
Gives an element's tooltip the ability to be shown. **Tooltips are enabled by default.**
{{< highlight js >}}tooltip.enable(){{< /highlight >}}
```js
tooltip.enable()
```
#### disable
Removes the ability for an element's tooltip to be shown. The tooltip will only be able to be shown if it is re-enabled.
{{< highlight js >}}tooltip.disable(){{< /highlight >}}
```js
tooltip.disable()
```
#### toggleEnabled
Toggles the ability for an element's tooltip to be shown or hidden.
{{< highlight js >}}tooltip.toggleEnabled(){{< /highlight >}}
```js
tooltip.toggleEnabled()
```
#### update
Updates the position of an element's tooltip.
{{< highlight js >}}tooltip.update(){{< /highlight >}}
```js
tooltip.update()
```
#### getInstance
*Static* method which allows you to get the tooltip instance associated with a DOM element
{{< highlight js >}}
```js
var exampleTriggerEl = document.getElementById('example')
var tooltip = bootstrap.Tooltip.getInstance(exampleTriggerEl) // Returns a Bootstrap tooltip instance
{{< /highlight >}}
```
### Events
@@ -400,7 +416,7 @@ var tooltip = bootstrap.Tooltip.getInstance(exampleTriggerEl) // Returns a Boots
</tbody>
</table>
{{< highlight js >}}
```js
var myTooltipEl = document.getElementById('myTooltip')
var tooltip = new bootstrap.Tooltip(myTooltipEl)
@@ -409,4 +425,4 @@ myTooltipEl.addEventListener('hidden.bs.tooltip', function () {
})
tooltip.hide()
{{< /highlight >}}
```