1
0
mirror of https://github.com/twbs/bootstrap.git synced 2025-02-24 12:40:58 +00:00

rewrite alerts docs a bit

This commit is contained in:
Mark Otto 2015-08-10 16:36:44 -07:00
parent 121615ceba
commit c74e47a139

View File

@ -93,13 +93,10 @@ Note that closing an alert will remove it from the DOM.
### Methods ### Methods
#### $().alert() | Method | Description |
| --- | --- |
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.) | `$().alert()` | 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.) |
| `$().alert('close')` | Closes an alert by removing it from the DOM. If the `.fade` and `.in` classes are present on the element, the alert will fade out before it is removed. |
#### $().alert('close')
Closes an alert by removing it from the DOM. If the `.fade` and `.in` classes are present on the element, the alert will fade out before it is removed.
{% highlight js %}$(".alert").alert('close'){% endhighlight %} {% highlight js %}$(".alert").alert('close'){% endhighlight %}
@ -107,26 +104,10 @@ Closes an alert by removing it from the DOM. If the `.fade` and `.in` classes ar
Bootstrap's alert plugin exposes a few events for hooking into alert functionality. Bootstrap's alert plugin exposes a few events for hooking into alert functionality.
<div class="table-responsive"> | Event | Description |
<table class="table table-bordered table-striped"> | --- | --- |
<thead> | `close.bs.alert` | This event fires immediately when the <code>close</code> instance method is called. |
<tr> | `closed.bs.alert` | This event is fired when the alert has been closed (will wait for CSS transitions to complete). |
<th style="width: 150px;">Event Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>close.bs.alert</td>
<td>This event fires immediately when the <code>close</code> instance method is called.</td>
</tr>
<tr>
<td>closed.bs.alert</td>
<td>This event is fired when the alert has been closed (will wait for CSS transitions to complete).</td>
</tr>
</tbody>
</table>
</div>
{% highlight js %} {% highlight js %}
$('#myAlert').on('closed.bs.alert', function () { $('#myAlert').on('closed.bs.alert', function () {