modo.Notification
Notification Elements are displayed inside modo.NotificationContainer elements. They are used to inform your users about things that happened inside the application and are meant to replace basic alert() calls.
Constructor
modo.Notification(params)modo.Notification
The following list of parameters can be used in the params object, passed to the constructor. Parameters in [brackets] are optional.
Property | Description |
---|---|
content | Any HTML content you want to display inside the notification element. |
[duration] | The amount of time in milliseconds, the notification should stay on screen after it has been displayed. If not defined, the default amount from the surrounding modo.NotificationContainer is used. Default: Tip: If you want to create sticky notifications, just set the duration to |
[className] | A string with custom CSS classes to apply to the generated DOM element |
[dataAttributes] | A object with attributes to assign to the generated DOM element. Omit the "data-" part. So for example |
[el] | The jQuery enhanced DOM element to be generated. If nothing is set, a standard DIV container will be created. If you want to use a different DOM element, pass a jQuery generated DOM element to this parameter. |
[showEffect] | The default show effect for the element. See associated property description. Default: |
[hideEffect] | The default hide effect for the element. See associated property description. Default: |
Properties
displayTimeNumber
Amount of time in milliseconds the notification should stay on screen. Will be set through the constructor.
Inherited Properties from modo.Element
elObject
Contains the jQuery enhanced DOM Node of this modoJS element.
modoIdNumber
Contains a internally given, numeric ID for this element.
visibleBool
Will be set by .show()
and .hide()
. Access this property to check the current visibility of the element.
showEffectobject
Set a default show effect (like the options you can pass to the show()
/ hide()
methods.
Example:
element.showEffect = {
effect: 'slideDown',
effectArgs: ['fast']
};
hideEffectobject
Define a default hide effect instead of a simple, instant hide.
Methods
set(html)this
Replaces the notifications HTML content.
hide()this
Will make the surrounding modo.NotificationContainer remove the element from its stack.
Events
show
Triggered when the notification became visible in the surrounding modo.NotificationContainer. Notice: It can take some time until this is triggered, in case already more notifications are queued than the containers displayLimit allows to be shown.
hide
Triggered when the notification has been hidden (and removed) from the surrounding modo.NotificationContainer.
Inherited Events from modo.Element
show
Triggered, when the object has been displayed through show()
hide
Triggered, when the object has been hidden through hide()
CSS Classes
mdo-notification
Applied on the element.
Inherited CSS Classes from modo.Element
mdo-element
Basic class that will be applied to every element that extends modo.Element
.
mdo-flexible
Will be applied to every modo element where setFlexible(true)
has been called upon.