Minimal Alert Message In Plain JavaScript – Msg.js

Category: Javascript , Notification | February 17, 2022
Author:sancho1952007
Views Total:95 views
Official Page:Go to website
Last Update:February 17, 2022
License:MIT

Preview:

Minimal Alert Message In Plain JavaScript – Msg.js

Description:

An ultra-light JavaScript library that enables you to display an animated, fixed alert notification on the page.

How to use it:

1. Import the minified version of the Msg.js library.

<script src="msg.min.js"></script>

2. Call the message() function and define the text to be displayed in the alert notification.

message("Hello World!");

3. Override the default styles of the alert notification.

div.style.animation='msg 1s linear';
div.setAttribute('id', 'div_Msg')
div.style.backgroundColor = 'lightblue';
div.style.position='fixed';
div.style.display='flex';
div.innerHTML='&nbsp;<center><h3 style="cursor: default;" class="msg-text">'+text+'</h3></center><button onclick="closeMsg()" class="msg-text" style="cursor: pointer; background-color: transparent; border: 0px; outline: none; color: grey;">&nbsp;&nbsp;X&nbsp;</button></center>';
div.style.left='10px';
div.style.top='10px';
div.style.fontFamily="monospace";

You Might Be Interested In:


Leave a Reply