Jump to content

ips.ui.flashMsg

Description

The flashMsg widget can be used to display a 'flash message' to the user - a short notification that appears on the screen for a few seconds, before disappearing. It is commonly used for 'success' messages when an action occurs.

 

Example

@todo

 

Usage

A flash message can be created with the data API, as follows:

<span data-ipsFlashMsg data-ipsFlashMsg-text='My message'>

The element used with this method is not important; the widget will not interact with the element in any way.

However, in most cases, flash messages will be created on the fly in response to user actions, so the more common use will be calling them programatically. This can be done in javascript modules with the following code:

ips.ui.flashMsg.show('My message');

Flash messages can be automatically created in two additional ways:

  • Cookies - set a cookie with the key flmsg. The cookie will be deleted after the message displays.
  • URL - pass the parameter flmsg in the page URL, with the value being the message to show. The value should be URL encoded.

 

Options

text
(String; required)

The text to display in the flash message. A sentence or two maximum is recommended.

 

extraClasses
(String; optional; default 'ipsPad')

A space-separated string of extra CSS classnames that will be applied to the flash message box.

 

timeout
(Number; optional; default 2)

The number of seconds for which this flash will be shown before hiding itself.

 

Events

closeFlashMsg.flashMsg

Hides the currently-shown flash message. If any messages are queued, the next will be shown automatically.

Edited by Rikki

  Report Guide


×
×
  • Create New...