Skip to main content
Figuration v3 Preview Available!

Bring interactivity to your site with a selection of jQuery widgets (plugins) all built with accessibility and usability in mind.


Enable dismiss functionality for alert messages.



<div class="alert alert-warning" role="alert">
    <button type="button" class="close" data-cfw-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>
    <strong>Warning!</strong> Objects in the mirror are closer than they appear.

<div class="alert alert-danger" role="alert">
    <h4>Oops! 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>
        <button type="button" class="btn btn-danger">Take this action</button>
        <button type="button" class="btn btn-secondary" data-cfw-dismiss="alert">Close</button>

The dismiss even works with dynamically inserted alerts.


Via Data Attributes

Just add data-cfw-dismiss="alert" to a close button inside the alert container to automatically give an alert close functionality.

Via JavaScript

Enable dismissal of an alert via JavaScript:



Options can be passed via data attributes or JavaScript. For data attributes, append the option name to data-cfw-alert, as in data-cfw-alert-animate="false".

Name Type Default Description
target string null The selector (jQuery style) of the target item to be closed.
animate boolean true If alert targets should fade out.
speed integer 150 Speed of animation (milliseconds) - corresponds the animation speed specified in CSS.



Activates the alert as a closable element. Accepts an optional options object.

    animate: false


Closes an alert.


Event callbacks happen on the target alert container.

Event Type Description
init.cfw.alert This event fires after the collapse item is initialized.
beforeClose.cfw.alert This event is fired immediately when the close method is called.
afterClose.cfw.alert This event is fired when an alert has been closed. (will wait for CSS transitions to complete).

$('#myAlert').on('beforeClose.cfw.alert', function () {
  // do something...