getButterfly
Resume

NAVIGATION

ATTRIBUTION

getButterfly
Dublin, Ireland

All Content Copyright ©2019
getButterfly

RoarJS – JavaScript Alert/Confirm Replacement

RoarJS is a wonderful, responsive, customisable, 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.

See RoarJS Demo on Codepen Get RoarJS 1.0.5 from GitHub

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.

Find more JavaScript tutorials, code snippets and samples here or more jQuery tutorials, code snippets and samples here.

Added by Ciprian on Wednesday, May 9, 2018 in Blog, JavaScript

Do you want better SEO? More traffic? More conversions? More growth? We help companies exponentially grow their traffic and conversions, while outranking their competitors. With more than 10 years of experience, we’ve learned what is valuable to our clients.
SEO Dublin | SEO Malta

Related Articles

My Battle Tested Recommendations
Disclaimer: These recommendations contain affiliate links.

Jetpack
Dreamhost
WordPress.com
CodeCanyon
SEMrush
SEMrush

Privacy Policy