RoarJS is a wonderful, responsive, customizable, accessible (WAI-ARIA), zero-dependency, vanilla JavaScript alert/confirm replacement.
RoarJS automatically centers itself on the page and looks great no matter if you’re using a desktop computer, mobile, or tablet.
RoarJS is free, tiny, and it works in any browser.
How to use
Demo 1: A basic alert
roar('A basic title');
Demo 2: A basic alert with title, message and Confirm button:
roar('A basic title', 'This is a basic message. As basic as it can get. What now?');
Demo 3: An alert with title, message, Confirm button and Cancel button
var options = {
cancel: true,
cancelText: 'cancel',
cancelCallBack: function (event) {
console.log('options.cancelCallBack');
},
confirm: true,
confirmText: 'confirm',
confirmCallBack: function (event) {
console.log('options.confirmCallBack');
}
}
roar('Official enquiry', 'Do you like <strong>Roar</strong> so far? Do you?', options);
What?! Do you need more?
That’s it! Less than 200 lines, 775 bytes (gzipped) or 3.87 KB minified.
How to install
<link rel="stylesheet" href="roar.min.css">
<script src="roar.min.js"></script>
Or include it in your JavaScript functions file and your main stylesheet.
How to reuse
If you need to reuse the script in several modules, such as in your WordPress theme and in your WordPress plugin, use the below:
var myRedeclaredRoar = function roar(title, message, options) {
// Roar function here
}
No kittens were harmed in the making of this script.