Messages

Versatile and refined messages, ideal for daily use

Usage

You have 2 modules waiting to installation. Install
<div class="message" data-component="message"> ...  <span class="close small"></span></div>
You have 2 modules waiting to installation. Install
<div class="message error" data-component="message"> ...  <span class="close small"></span></div>
You have 2 modules waiting to installation. Install
<div class="message success" data-component="message"> ...  <span class="close small"></span></div>
Warning!
You have 2 modules waiting to installation. Install
<div class="message warning" data-component="message">
    <h5>...</h5>
    ...
    <span class="close small"></span>
</div>
You have 2 modules waiting to installation. Install
<div class="message focus" data-component="message"> ...  <span class="close small"></span></div>
You have 2 modules waiting to installation. Install
<div class="message black" data-component="message"> ...  <span class="close small"></span></div>
You have 2 modules waiting to installation. Install
<div class="message inverted" data-component="message"> ...  <span class="close small"></span></div>

Options

NameTypeDefault
closeSelectorstring.close
closeEventstringclick
animationOpenstringfadeIn
animationClosestringfadeOut

Set an option

Via data attribute:

<div class="message" data-component="message" data-close-selector=".my-custom-close">
    ... <span class="my-custom-close small"></span>
</div>

Via Javascript:

$('#my-message').message({
    closeSelector: '.my-custom-close'
});

Methods

You have 2 modules waiting to installation. Install
MethodDescription
closeManually closes a message.
openOpens a message if it has been closed.

Example

$('#my-message').message('close');

Callbacks

CallbackDescription
openThis event fires immediately when the open instance method is called.
openedThis event is fired when the message has been opened, will wait for CSS animation to complete.
closeThis event fires immediately when the close instance method is called.
closedThis event is fired when the message has been closed, will wait for CSS animation to complete.

Example

$('#my-message').on('closed.message', function()
{
    // do something
})