forked from fabien-d/alertify.js
-
Notifications
You must be signed in to change notification settings - Fork 0
How to Use
fabien-d edited this page Dec 10, 2012
·
5 revisions
alertify can now be installed using bower.
$ bower install alertify
Include JS
<!-- ideally at the bottom of the page -->
<!-- also works in the <head> -->
<script src="PATH_TO_FILE/alertify.min.js"></script>
Include CSS
<!-- include the core styles -->
<link rel="stylesheet" href="PATH_TO_FILE/alertify.core.css" />
<!-- include a theme, can be included into the core instead of 2 separate files -->
<link rel="stylesheet" href="PATH_TO_FILE/alertify.default.css" />
define(["PATH_TO_FILE/alertify.min"], function (alertify) {
// alertify is now available
});
alertify.log( message, type );
shorthand available to "success" and "error"
alertify.success( message ); // same as alertify.log( message, "success" );
alertify.error( message ); // same as alertify.log( message, "error" );
extend method allows for custom methods
alertify.custom = alertify.extend( "custom" );
alertify.custom( message ); // same as alertify.log( message, "custom" );
alertify.alert( message, function () {
//after clicking OK
});
alertify.confirm( message, function (e) {
if (e) {
//after clicking OK
} else {
//after clicking Cancel
}
});
alertify.prompt( message, function (e, str) {
if (e) {
// after clicking OK
// str is the value from the textbox
} else {
// after clicking Cancel
}
});
alertify.alert(...).confirm(...)...