From a7f4fc5849f96e6566747d2cc9c9d64b1962841e Mon Sep 17 00:00:00 2001 From: Mark Otto Date: Fri, 17 Apr 2015 19:51:15 -0700 Subject: [PATCH] rewrite alert docs --- docs/components/alerts.md | 64 +++++++++++---------------------------- 1 file changed, 17 insertions(+), 47 deletions(-) diff --git a/docs/components/alerts.md b/docs/components/alerts.md index 83f34f5b7e..a7d43400ad 100644 --- a/docs/components/alerts.md +++ b/docs/components/alerts.md @@ -3,15 +3,11 @@ layout: page title: Alerts --- -Provide contextual feedback messages for typical user actions with the handful of available and flexible alert messages. For inline dismissal, use the [alerts jQuery plugin]({{ site.baseurl }}javascript/#alerts). +Provide contextual feedback messages for typical user actions with the handful of available and flexible alert messages. -Wrap any text and an optional dismiss button in `.alert` and one of the four contextual classes (e.g., `.alert-success`) for basic alert messages. - -{% callout info %} -#### No default class +## Examples -Alerts don't have default classes, only base and modifier classes. A default gray alert doesn't make too much sense, so you're required to specify a type via contextual class. Choose from success, info, warning, or danger. -{% endcallout %} +Alerts are available for any length of text, as well as an optional dismiss button. For proper styling, use one of the four **required** contextual classes (e.g., `.alert-success`). For inline dismissal, use the [alerts jQuery plugin](#dismissing). {% example html %} {% endexample %} -### Dismissing - -Build on any alert by adding an optional `.alert-dismissible` and [close button](). - -{% example html %} - -{% endexample %} - -{% callout warning %} -#### Ensure proper behavior across all devices - -Be sure to use the ` - Holy guacamole! Best check yo self, you're not looking too good. + Holy guacamole! You should check in on some of those fields below. {% endexample %} -When using a `.close` button, it must be the first child of the `.alert-dismissible` and no text content may come before it in the markup. - -{% example html %} - -{% endexample %} +## JavaScript behavior -## Usage +### Triggers Enable dismissal of an alert via JavaScript: @@ -102,9 +74,7 @@ Enable dismissal of an alert via JavaScript: $(".alert").alert() {% endhighlight %} -### Markup - -Just add `data-dismiss="alert"` to your close button to automatically give an alert close functionality. Closing an alert removes it from the DOM. +Or with `data` attributes on a button **within the alert**, as demonstrated above: {% highlight html %} {% endhighlight %} -To have your alerts use animation when closing, make sure they have the `.fade` and `.in` classes already applied to them. +Note that closing an alert will remove it from the DOM. ### Methods -- 2.47.2