<a href="#" data-toggle="tooltip" title="first tooltip">Hover over me</a>
{% endhighlight %}
- <h3>Methods</h3>
-
- <h4>$().tooltip(options)</h4>
- <p>Attaches a tooltip handler to an element collection.</p>
-
- <h4>.tooltip('show')</h4>
- <p>Reveals an element's tooltip.</p>
- {% highlight js %}$('#element').tooltip('show'){% endhighlight %}
-
- <h4>.tooltip('hide')</h4>
- <p>Hides an element's tooltip.</p>
- {% highlight js %}$('#element').tooltip('hide'){% endhighlight %}
-
- <h4>.tooltip('toggle')</h4>
- <p>Toggles an element's tooltip.</p>
- {% highlight js %}$('#element').tooltip('toggle'){% endhighlight %}
-
- <h4>.tooltip('destroy')</h4>
- <p>Hides and destroys an element's tooltip.</p>
- {% highlight js %}$('#element').tooltip('destroy'){% endhighlight %}
-
- <h3>Events</h3>
- <table class="table table-bordered table-striped">
- <thead>
- <tr>
- <th style="width: 150px;">Event Type</th>
- <th>Description</th>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td>show</td>
- <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 the tooltip 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> instance method has been called.</td>
- </tr>
- <tr>
- <td>hidden</td>
- <td>This event is fired when the tooltip has finished being hidden from the user (will wait for CSS transitions to complete).</td>
- </tr>
- </tbody>
- </table>
+ <h3>Methods</h3>
+
+ <h4>$().tooltip(options)</h4>
+ <p>Attaches a tooltip handler to an element collection.</p>
+
+ <h4>.tooltip('show')</h4>
+ <p>Reveals an element's tooltip.</p>
+ {% highlight js %}$('#element').tooltip('show'){% endhighlight %}
+
+ <h4>.tooltip('hide')</h4>
+ <p>Hides an element's tooltip.</p>
+ {% highlight js %}$('#element').tooltip('hide'){% endhighlight %}
+
+ <h4>.tooltip('toggle')</h4>
+ <p>Toggles an element's tooltip.</p>
+ {% highlight js %}$('#element').tooltip('toggle'){% endhighlight %}
+
+ <h4>.tooltip('destroy')</h4>
+ <p>Hides and destroys an element's tooltip.</p>
+ {% highlight js %}$('#element').tooltip('destroy'){% endhighlight %}
- </div>
-
+
++ <h3>Events</h3>
++ <table class="table table-bordered table-striped">
++ <thead>
++ <tr>
++ <th style="width: 150px;">Event Type</th>
++ <th>Description</th>
++ </tr>
++ </thead>
++ <tbody>
++ <tr>
++ <td>show</td>
++ <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 the tooltip 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> instance method has been called.</td>
++ </tr>
++ <tr>
++ <td>hidden</td>
++ <td>This event is fired when the tooltip has finished being hidden from the user (will wait for CSS transitions to complete).</td>
++ </tr>
++ </tbody>
++ </table>
+ {% highlight js %}
+ $('#myTooltip').on('hidden.bs.tooltip', function () {
- // do something…
++// do something…
+ })
+ {% endhighlight %}
- </section>
++ </div>
+ <!-- Popovers
+ ================================================== -->
+ <div class="bs-docs-section">
+ <div class="page-header">
+ <h1 id="popovers">Popovers <small>popover.js</small></h1>
+ </div>
+ <h2 id="popovers-examples">Examples</h2>
+ <p>Add small overlays of content, like those on the iPad, to any element for housing secondary information. Hover over the button to trigger the popover.</p>
- <!-- Popovers
- ================================================== -->
- <section id="popovers">
- <div class="page-header">
- <h1>Popovers <small>popover.js</small></h1>
+ <div class="bs-callout bs-callout-danger">
+ <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-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>
+
+ <h3>Static popover</h3>
+ <p>Four options are available: top, right, bottom, and left aligned.</p>
+ <div class="bs-example bs-example-popover">
+ <div class="popover top">
+ <div class="arrow"></div>
+ <h3 class="popover-title">Popover top</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>
+ </div>
- <h2>Examples</h2>
- <p>Add small overlays of content, like those on the iPad, to any element for housing secondary information. Hover over the button to trigger the popover.</p>
+ <div class="popover right">
+ <div class="arrow"></div>
+ <h3 class="popover-title">Popover right</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>
+ </div>
- <div class="bs-callout bs-callout-danger">
- <h4>Plugin dependency</h4>
- <p>Popovers require the <a href="#tooltips">tooltip plugin</a> to be included in your version of Bootstrap.</p>
+ <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>
- <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="popover left">
+ <div class="arrow"></div>
+ <h3 class="popover-title">Popover left</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>
+ </div>
- <h3>Static popover</h3>
- <p>Four options are available: top, right, bottom, and left aligned.</p>
- <div class="bs-example bs-example-popover">
- <div class="popover top">
- <div class="arrow"></div>
- <h3 class="popover-title">Popover top</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>
- </div>
+ <div class="clearfix"></div>
+ </div>
- <div class="popover right">
- <div class="arrow"></div>
- <h3 class="popover-title">Popover right</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>
- </div>
+ <h3>Live demo</h3>
+ <div class="bs-example" style="padding-bottom: 24px;">
+ <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>
- <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>
- </div>
+ <h4>Four directions</h4>
+ <div class="bs-example tooltip-demo">
+ <div class="bs-example-tooltips">
+ <button type="button" class="btn btn-default" data-toggle="popover" data-placement="top" data-content="Vivamus sagittis lacus vel augue laoreet rutrum faucibus.">
+ Popover on top
+ </button>
+ <button type="button" class="btn btn-default" data-toggle="popover" data-placement="right" data-content="Vivamus sagittis lacus vel augue laoreet rutrum faucibus.">
+ Popover on right
+ </button>
+ <button type="button" class="btn btn-default" data-toggle="popover" data-placement="bottom" data-content="Vivamus sagittis lacus vel augue laoreet rutrum faucibus.">
+ Popover on bottom
+ </button>
+ <button type="button" class="btn btn-default" data-toggle="popover" data-placement="left" data-content="Vivamus sagittis lacus vel augue laoreet rutrum faucibus.">
+ Popover on left
+ </button>
+ </div>
+ </div><!-- /example -->
- <div class="popover left">
- <div class="arrow"></div>
- <h3 class="popover-title">Popover left</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>
- </div>
- <div class="clearfix"></div>
- </div>
+ <h2 id="popovers-usage">Usage</h2>
+ <p>Enable popovers via JavaScript:</p>
+ {% highlight js %}$('#example').popover(options){% endhighlight %}
- <h3>Live demo</h3>
- <div class="bs-example" style="padding-bottom: 24px;">
- <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>
+ <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>
+ <table class="table table-bordered table-striped">
+ <thead>
+ <tr>
+ <th style="width: 100px;">Name</th>
+ <th style="width: 100px;">type</th>
+ <th style="width: 50px;">default</th>
+ <th>description</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td>animation</td>
+ <td>boolean</td>
+ <td>true</td>
+ <td>apply a CSS fade transition to the tooltip</td>
+ </tr>
+ <tr>
+ <td>html</td>
+ <td>boolean</td>
+ <td>false</td>
+ <td>Insert HTML into the popover. If false, jQuery's <code>text</code> method will be used to insert content into the DOM. Use text if you're worried about XSS attacks.</td>
+ </tr>
+ <tr>
+ <td>placement</td>
+ <td>string | function</td>
+ <td>'right'</td>
+ <td>how to position the popover - top | bottom | left | right | auto.<br> When "auto" is specified, it will dynamically reorient the popover. For example, if placment is "auto left", the tooltip will display to the left when possible, otherwise it will display right.</td>
+ </tr>
+ <tr>
+ <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/KPeKS/4/">an informative example</a>.</td>
+ </tr>
+ <tr>
+ <td>trigger</td>
+ <td>string</td>
+ <td>'click'</td>
+ <td>how popover is triggered - click | hover | focus | manual</td>
+ </tr>
+ <tr>
+ <td>title</td>
+ <td>string | function</td>
+ <td>''</td>
+ <td>default title value if <code>title</code> attribute isn't present</td>
+ </tr>
+ <tr>
+ <td>content</td>
+ <td>string | function</td>
+ <td>''</td>
+ <td>default content value if <code>data-content</code> attribute isn't present</td>
+ </tr>
+ <tr>
+ <td>delay</td>
+ <td>number | object</td>
+ <td>0</td>
+ <td>
+ <p>delay showing and hiding the popover (ms) - does not apply to manual trigger type</p>
+ <p>If a number is supplied, delay is applied to both hide/show</p>
+ <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. Example: <code>container: 'body'</code></p>
+ </td>
+ </tr>
+ </tbody>
+ </table>
+ <div class="bs-callout bs-callout-info">
+ <h4>Data attributes for individual popovers</h4>
+ <p>Options for individual popovers can alternatively be specified through the use of data attributes, as explained above.</p>
+ </div>
- <h4>Four directions</h4>
- <div class="bs-example tooltip-demo">
- <ul class="bs-example-tooltips">
- <li><a href="#" class="btn btn-default" 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 btn-default" 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 btn-default" 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 btn-default" 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><!-- /example -->
-
-
- <hr class="bs-docs-separator">
-
-
- <h2>Usage</h2>
- <p>Enable popovers via JavaScript:</p>
- {% highlight js %}$('#example').popover(options){% 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>
- <table class="table table-bordered table-striped">
- <thead>
- <tr>
- <th style="width: 100px;">Name</th>
- <th style="width: 100px;">type</th>
- <th style="width: 50px;">default</th>
- <th>description</th>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td>animation</td>
- <td>boolean</td>
- <td>true</td>
- <td>apply a CSS fade transition to the tooltip</td>
- </tr>
- <tr>
- <td>html</td>
- <td>boolean</td>
- <td>false</td>
- <td>Insert HTML into the popover. If false, jQuery's <code>text</code> method will be used to insert content into the DOM. Use text if you're worried about XSS attacks.</td>
- </tr>
- <tr>
- <td>placement</td>
- <td>string | function</td>
- <td>'right'</td>
- <td>how to position the popover - top | bottom | left | right | auto.<br> When "auto" is specified, it will dynamically reorient the popover. For example, if placment is "auto left", the tooltip will display to the left when possible, otherwise it will display right.</td>
- </tr>
- <tr>
- <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/twitter/bootstrap/issues/4215">this</a> and <a href="http://jsfiddle.net/KPeKS/4/">an informative example</a>.</td>
- </tr>
- <tr>
- <td>trigger</td>
- <td>string</td>
- <td>'click'</td>
- <td>how popover is triggered - click | hover | focus | manual</td>
- </tr>
- <tr>
- <td>title</td>
- <td>string | function</td>
- <td>''</td>
- <td>default title value if <code>title</code> attribute isn't present</td>
- </tr>
- <tr>
- <td>content</td>
- <td>string | function</td>
- <td>''</td>
- <td>default content value if <code>data-content</code> attribute isn't present</td>
- </tr>
- <tr>
- <td>delay</td>
- <td>number | object</td>
- <td>0</td>
- <td>
- <p>delay showing and hiding the popover (ms) - does not apply to manual trigger type</p>
- <p>If a number is supplied, delay is applied to both hide/show</p>
- <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. Example: <code>container: 'body'</code></p>
- </td>
- </tr>
- </tbody>
- </table>
- <div class="bs-callout bs-callout-info">
- <h4>Data attributes for individual popovers</h4>
- <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>
+
+ <h4>.popover('show')</h4>
+ <p>Reveals an elements popover.</p>
+ {% highlight js %}$('#element').popover('show'){% endhighlight %}
- <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>
-
- <h4>.popover('show')</h4>
- <p>Reveals an elements popover.</p>
- {% highlight js %}$('#element').popover('show'){% endhighlight %}
-
- <h4>.popover('hide')</h4>
- <p>Hides an elements popover.</p>
- {% highlight js %}$('#element').popover('hide'){% endhighlight %}
-
- <h4>.popover('toggle')</h4>
- <p>Toggles an elements popover.</p>
- {% highlight js %}$('#element').popover('toggle'){% endhighlight %}
-
- <h4>.popover('destroy')</h4>
- <p>Hides and destroys an element's popover.</p>
- {% highlight js %}$('#element').popover('destroy'){% endhighlight %}
-
- <h3>Events</h3>
- <table class="table table-bordered table-striped">
- <thead>
- <tr>
- <th style="width: 150px;">Event Type</th>
- <th>Description</th>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td>show</td>
- <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 the popover 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> instance method has been called.</td>
- </tr>
- <tr>
- <td>hidden</td>
- <td>This event is fired when the popover has finished being hidden from the user (will wait for CSS transitions to complete).</td>
- </tr>
- </tbody>
- </table>
+ <h4>.popover('hide')</h4>
+ <p>Hides an elements popover.</p>
+ {% highlight js %}$('#element').popover('hide'){% endhighlight %}
+
+ <h4>.popover('toggle')</h4>
+ <p>Toggles an elements popover.</p>
+ {% highlight js %}$('#element').popover('toggle'){% endhighlight %}
+
+ <h4>.popover('destroy')</h4>
+ <p>Hides and destroys an element's popover.</p>
+ {% highlight js %}$('#element').popover('destroy'){% endhighlight %}
++ <h3>Events</h3>
++ <table class="table table-bordered table-striped">
++ <thead>
++ <tr>
++ <th style="width: 150px;">Event Type</th>
++ <th>Description</th>
++ </tr>
++ </thead>
++ <tbody>
++ <tr>
++ <td>show</td>
++ <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 the popover 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> instance method has been called.</td>
++ </tr>
++ <tr>
++ <td>hidden</td>
++ <td>This event is fired when the popover has finished being hidden from the user (will wait for CSS transitions to complete).</td>
++ </tr>
++ </tbody>
++ </table>
+ {% highlight js %}
+ $('#myPopover').on('hidden.bs.popover', function () {
+ // do something…
+ })
+ {% endhighlight %}
- </section>
+ </div>
-
-
+ <!-- Alert
+ ================================================== -->
+ <div class="bs-docs-section">
+ <div class="page-header">
+ <h1 id="alerts">Alert messages <small>alert.js</small></h1>
+ </div>
- <!-- Alert
- ================================================== -->
- <div class="bs-docs-section" id="js-alerts">
- <div class="page-header">
- <h1>Alert messages <small>alert.js</small></h1>
- </div>
+ <h2 id="alerts-examples">Example alerts</h2>
+ <p>Add dismiss functionality to all alert messages with this plugin.</p>
+ <div class="bs-example">
+ <div class="alert fade in">
+ <button type="button" class="close" data-dismiss="alert">×</button>
+ <strong>Holy guacamole!</strong> Best check yo self, you're not looking too good.
+ </div>
+ </div><!-- /example -->
+ <div class="bs-example">
+ <div class="alert alert-block alert-error fade in">
+ <button type="button" class="close" data-dismiss="alert">×</button>
+ <h4>Oh snap! You got an error!</h4>
+ <p>Change this and that and try again. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit. Cras mattis consectetur purus sit amet fermentum.</p>
+ <p>
+ <a class="btn btn-danger" href="#">Take this action</a> <a class="btn btn-default" href="#">Or do this</a>
+ </p>
+ </div>
+ </div><!-- /example -->
- <h2>Example alerts</h2>
- <p>Add dismiss functionality to all alert messages with this plugin.</p>
- <div class="bs-example">
- <div class="alert fade in">
- <button type="button" class="close" data-dismiss="alert">×</button>
- <strong>Holy guacamole!</strong> Best check yo self, you're not looking too good.
- </div>
- </div><!-- /example -->
-
- <div class="bs-example">
- <div class="alert alert-block alert-error fade in">
- <button type="button" class="close" data-dismiss="alert">×</button>
- <h4>Oh snap! You got an error!</h4>
- <p>Change this and that and try again. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit. Cras mattis consectetur purus sit amet fermentum.</p>
- <p>
- <a class="btn btn-danger" href="#">Take this action</a> <a class="btn btn-default" href="#">Or do this</a>
- </p>
- </div>
- </div><!-- /example -->
-
-
- <hr class="bs-docs-separator">
-
-
- <h2>Usage</h2>
- <p>Enable dismissal of an alert via JavaScript:</p>
- {% highlight js %}$(".alert").alert(){% endhighlight %}
-
- <h3>Markup</h3>
- <p>Just add <code>data-dismiss="alert"</code> to your close button to automatically give an alert close functionality.</p>
- {% highlight html %}<a class="close" data-dismiss="alert" href="#">×</a>{% endhighlight %}
-
- <h3>Methods</h3>
-
- <h4>$().alert()</h4>
- <p>Wraps all alerts with close functionality. To have your alerts animate out when closed, make sure they have the <code>.fade</code> and <code>.in</code> class already applied to them.</p>
-
- <h4>.alert('close')</h4>
- <p>Closes an alert.</p>
- {% highlight js %}$(".alert").alert('close'){% endhighlight %}
-
-
- <h3>Events</h3>
- <p>Bootstrap's alert class exposes a few events for hooking into alert functionality.</p>
- <table class="table table-bordered table-striped">
- <thead>
- <tr>
- <th style="width: 150px;">Event Type</th>
- <th>Description</th>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td>close</td>
- <td>This event fires immediately when the <code>close</code> instance method is called.</td>
- </tr>
- <tr>
- <td>closed</td>
- <td>This event is fired when the alert has been closed (will wait for CSS transitions to complete).</td>
- </tr>
- </tbody>
- </table>
+
+ <h2 id="alerts-usage">Usage</h2>
+ <p>Enable dismissal of an alert via JavaScript:</p>
+ {% highlight js %}$(".alert").alert(){% endhighlight %}
+
+ <h3>Markup</h3>
+ <p>Just add <code>data-dismiss="alert"</code> to your close button to automatically give an alert close functionality.</p>
+ {% highlight html %}<a class="close" data-dismiss="alert" href="#">×</a>{% endhighlight %}
+
+ <h3>Methods</h3>
+
+ <h4>$().alert()</h4>
+ <p>Wraps all alerts with close functionality. To have your alerts animate out when closed, make sure they have the <code>.fade</code> and <code>.in</code> class already applied to them.</p>
+
+ <h4>.alert('close')</h4>
+ <p>Closes an alert.</p>
+ {% highlight js %}$(".alert").alert('close'){% endhighlight %}
+
+
+ <h3>Events</h3>
+ <p>Bootstrap's alert class exposes a few events for hooking into alert functionality.</p>
+ <table class="table table-bordered table-striped">
+ <thead>
+ <tr>
+ <th style="width: 150px;">Event Type</th>
+ <th>Description</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td>close</td>
+ <td>This event fires immediately when the <code>close</code> instance method is called.</td>
+ </tr>
+ <tr>
+ <td>closed</td>
+ <td>This event is fired when the alert has been closed (will wait for CSS transitions to complete).</td>
+ </tr>
+ </tbody>
+ </table>
{% highlight js %}
$('#my-alert').bind('closed.bs.alert', function () {
// do something…