JS Alerts
From FreeDESK
(Difference between revisions)
(Created page with "= Overview = The on-screen alerts are the little coloured information bars you get at the top of the screen and are created using the Alerts instance of FreeDESK_Alerts = Us...") |
Latest revision as of 23:22, 27 June 2012
Contents |
[edit] Overview
The on-screen alerts are the little coloured information bars you get at the top of the screen and are created using the Alerts instance of FreeDESK_Alerts
[edit] Use and Example
To add an alert call the method Alerts.add(text, level, autoRemove) with the options being the text to display, the level (0 is good and green in default CSS, 1 is warning and yellow in default CSS and 2 is bad and red in default CSS), the autoRemove is the number of seconds to display the alert for (0 means display forever until user manually clicks to close.
[edit] Example
Alerts.add("Hello World",0,20); // a green ok alert for 20 seconds Alerts.add("Error!",2,0); // An error (red) that must manually be removed
[edit] Other Functions
Alerts.clear() will clear all alerts.
Alerts.randomTest() will display a random-level and random-text alert for the default timeout.