2015-07-30 11:34:04 +00:00
## Flash message
2015-05-27 10:57:02 +00:00
Displays a floating flash message on the screen.
2015-07-30 11:34:04 +00:00
### Display onload
2016-09-29 05:57:03 +00:00
```html
2015-10-16 23:51:40 +00:00
< p data-control = "flash-message" data-interval = "5" class = "success" >
This message is created from a static element. It will go away in 5 seconds.
< / p >
2016-09-29 05:57:03 +00:00
```
< p data-control = "flash-message" data-interval = "5" class = "info" >
This message is created from a static element. It will go away in 5 seconds.
< / p >
< br / >
2015-07-30 11:34:04 +00:00
### Trigger
< p >
2016-04-26 18:44:02 +00:00
< a href = "#" class = "btn btn-primary" onclick = "$.oc.flashMsg({text: 'The record has been successfully saved. This message will go away in 1 second.', 'class': 'success', 'interval': 1}); return false;" >
2016-09-29 05:57:03 +00:00
Show Success
2015-10-16 23:51:40 +00:00
< / a >
2015-05-26 09:16:09 +00:00
2015-10-16 23:51:40 +00:00
< a href = "javascript:;" class = "btn btn-danger" onclick = "$.oc.flashMsg({text: 'Babam!', 'class': 'error'}); return false;" >
2016-09-29 05:57:03 +00:00
Show Error
2015-10-16 23:51:40 +00:00
< / a >
2015-05-26 09:16:09 +00:00
2015-10-16 23:51:40 +00:00
< a href = "javascript:;" class = "btn btn-warning" onclick = "$.oc.flashMsg({text: 'Warning! October is too good for this world!', 'class': 'warning'}); return false;" >
2016-09-29 05:57:03 +00:00
Show Warning
2015-10-16 23:51:40 +00:00
< / a >
2015-07-30 11:34:04 +00:00
< / p >
2015-10-16 23:51:40 +00:00
2016-09-29 05:57:03 +00:00
### Display static
A flash message can be rendered as a static element by attaching the `static` class. The `data-control` attribute is not needed.
< p class = "flash-message static success" >
Import completed successfully (success)
< / p >
< p class = "flash-message static info" >
Informative info box is informational (info)
< / p >
< p class = "flash-message static warning" >
Phasers have been set to stun (warning)
< / p >
< p class = "flash-message static error" >
We couldn't help you with that (error)
< / p >
2016-09-30 00:09:15 +00:00
### Data attributes
2015-10-16 23:51:40 +00:00
- data-control="flash-message" - enables the flash message plugin
- data-interval="2" - the interval to display the message in seconds, optional. Default: 2
2016-09-30 00:09:15 +00:00
### JavaScript API
2015-10-16 23:51:40 +00:00
```js
$.oc.flashMsg({
2016-04-29 07:36:52 +00:00
'text': 'Record saved.',
2015-10-16 23:51:40 +00:00
'class': 'success',
'interval': 3
})
```