Adding fully customizable notifications with Notify.js
In this recipe, we will show how to use the Notify.js plugin. To begin using it, we will install it via GitCDN.xyz. After that, we'll explore some of its many options.
To get acquainted with this plugin, navigate to https://notifyjs.com/ and https://github.com/jpillora/notifyjs/tree/master/dist.
Getting ready
Let's navigate to the raw Notify.js file on its GitHub repository and copy and paste it to the GitCDN.xyz interface. The link that we get back is https://gitcdn.xyz/repo/jpillora/notifyjs/master/dist/notify.js. We will use it in our recipe to reference this library.
How to do it…
- Add the Notify.js to the
_js.ejspartial in theapp/partialfolder:
<script src="https://gitcdn.xyz/repo/jpillora/notifyjs/master/dist/notify.js"></script>
- Add the following code to
app/partial/_recipe-06-10-js.ejs:
<script>
// Basic Example
$.notify("Click to hide or wait 20 seconds…");
</script>This should give us the Notify.js default...