Custom alert box using javaScript and css. This plugin will provide the functionality to customize the default JavaScript alert box.

Overview

customAlertBoxPlugin

Custom Alert Box Plugin Using JavaScript and CSS

Author: Suraj Aswal

Must Include CSS Code/Default Custom Alert Box Class:

/* must include css */
.custom-alert-box {
  position: absolute;
  top: 0%;
  padding: 20px;
  font-size: 16px;
  color: #ffffff;
  font-family: Arial, Helvetica, sans-serif;
  background-color: #58a6eb;
  animation: alert-box 1s ease;
}

@keyframes alert-box { 0% { top: -10%; } 100% { top: 0%; } }


You can also include your custom CSS to the alert box.

This Plugin has two type of Alert Boxes:

1). Alert Box on page load
2). Alert Box on Click the button.

Alert Box will automatically disappear after 4 seconds.

Demo link => Click for Demo

How to use this plugin?

Step 1:

Download the alert-box.js file.

Step 2:

Include the alert-box.js file to your HTML file
   <script src="alert-box.js"></script>

Step 3:

(1) Call customAlert() function for alert box on page load.
(2) Call alertOnClick() function for alert box on click.

<script defer>
   customAlert('This is custom alert Box !'); //alert box on load
   alertOnClick('alert-b', 'Custom Alert Box onClick'); //alert box on click
 </script>  

customAlert() function will take three arguments

  1. message
  2. allow custom css (optional)
  3. custom css className (optional)

Example:

<script defer>
  customAlert('This is custom alert Box !','allow','custom-class-name');
</script>

alertOnClick() function wil take four arguments

  1. Id Name of the element on which you want to apply onclick event.
  2. message
  3. allow custom css (optional)
  4. custom css className (optional

Example:

<script defer>
  alertOnClick('alert-b', 'Custom Alert Box onClick','allow','custom-class-name');
</script>

Note: By allowing custom css you give your own styling to the alert box.

You might also like...

Vaultacks lets users store files off-chain on Gaia. Files are encrypted by default but also can be made public and shared

Vaultacks lets users store files off-chain on Gaia. Files are encrypted by default but also can be made public and shared

Vaultacks Vaultacks is built on the Stacks Chain. It lets users upload files to Gaia, a off-chain data storage system. Vaultacks currently uses the de

Sep 14, 2022

A simple to-do app for managing daily tasks built with Webpack, JavaScript, HTML, and CSS with the functionality to manipulate multiple completed tasks and store them to local storage.

A simple to-do app for managing daily tasks built with Webpack, JavaScript, HTML, and CSS with the functionality to manipulate multiple completed tasks and store them to local storage.

TODO LIST APP In this project, I have built a simple HTML list of To Do tasks. The list is styled according to the listed specifications . This simple

Jun 7, 2022

Use plain functions as modifiers. Polyfill for RFC: 757 | Default Modifier Manager

Use plain functions as modifiers. Polyfill for RFC: 757 | Default Modifier Manager

Jan 14, 2022

This is an unofficial front end for Hacker News, reminiscent of the Windows XP era Outlook email client on a Windows XP default desktop

This is an unofficial front end for Hacker News, reminiscent of the Windows XP era Outlook email client on a Windows XP default desktop

Hacker XP Hacker News styled as the Windows XP Outlook email client. Try out Hacker XP here! Description This is an unofficial front end for Hacker Ne

Jul 12, 2022

Replaces the default Strapi WYSIWYG editor with a customized build of CKEditor 5 html editor packed with useful plugins.

Replaces the default Strapi WYSIWYG editor with a customized build of CKEditor 5 html editor packed with useful plugins.

CKEditor 5 for Strapi Replaces the default Strapi WYSIWYG editor with a customized build of CKEditor 5 packed with useful plugins. 👋 Get Started Feat

Jan 2, 2023

Default Description set by probot/settings

sanity-typed-schema-builder Build Sanity schemas declaratively and get typescript types of schema values for free! Typescript types for Sanity Values!

Jan 3, 2023

Tries to execute sync/async function, returns a specified default value if the function throws

good-try Tries to execute sync/async function, returns a specified default value if the function throws. Why Why not nice-try with it's 70+ million do

Dec 8, 2022

Chrome extension that switches default build tool to Maven at start.spring.io

start.spring.io default to Maven On the 18th of October 2022 https://start.spring.io switched the default build tool from Maven to Gradle spring-io/st

Dec 14, 2022

A Meme generator website where you can change and customize images to create great memes😎.

A Meme generator website where you can change and customize images to create great memes😎.

App Screenshot: Getting Started with Create React App This project was bootstrapped with Create React App. Available Scripts In the project directory,

Dec 21, 2022
Owner
Suraj Aswal
Web Developer
Suraj Aswal
It's an alert library build with JavaScript. You can replace your traditional JavaScript alert, confirm and toast with the library.

asteroid-alert It's an alert library build with JavaScript. You can replace your traditional JavaScript alert, confirm with the library. It has also e

Khan Md Sagar 4 Mar 12, 2021
Create Bootstrap 5 Modal Box using JavaScript with custom title, description, button labels and custom YES button callback

Dynamic BS5 Modal Box Create Bootstrap 5 Modal Box using JavaScript with custom title, description, button labels and custom YES button callback Insta

null 5 Oct 23, 2022
Kuldeep 2 Jun 21, 2022
This simple project aims to connect to an API to fetch score data and display it on a LeaderBoard box, as well as provide the tool to submit a new score.

Leader Board: Hit the API! This simple project aims to connect to an API to fetch score data and display it on a LeaderBoard box, as well as provide t

Andrés Felipe Arroyave Naranjo 12 Apr 6, 2022
This plugin integrates by default with Twitter bootstrap using badges to display the maximum lenght of the field where the user is inserting text. Uses the HTML5 attribute "maxlength" to work.

Bootstrap MaxLength This plugin integrates by default with Twitter bootstrap using badges to display the maximum length of the field where the user is

Maurizio 772 Dec 25, 2022
A component to quickly choose fonts from Google Web Fonts, custom fonts you (the web developer) provide, as well as system fonts.

Fontpicker jQuery Plugin A component to quickly choose fonts from Google Web Fonts, custom fonts you (the web developer) provide, as well as system fo

Arjan Haverkamp 24 Dec 3, 2022
Forked from hayes0724/shopify-packer Modern development tool for Shopify using Webpack 5. Easy to extend and customize, zero build config, compatible with Slate and existing websites.

Shopify Packer Modern development tool for Shopify using Webpack 5. Easy to extend and customize, zero build config, comes with starter themes and com

Web & Mobile | eCommerce | Full-Stack Developer 4 Nov 24, 2022
logseq custom.js and custom.css utilities : resize query table columns, hide namespaces...

logseq-custom-files custom.js and custom.css utilities for Logseq. current version v20220331 query table view : add handles on the query table headers

null 44 Dec 7, 2022
This is a simple javascript file that gives you control over the browser cursor, alowing for fully animated cursors using CSS's cursor functionality.

animatedWebCursors.js This is a simple javascript file that gives you control over the browser cursor, alowing for fully animated cursors using CSS's

alienmelon 32 Dec 25, 2022
📦 Alpine JS plugin to extend the functionality of the official $persist plugin

Alpine JS Persist Extended Alpine JS magic method $storage extends the official $persist plugin to help you work with local storage ?? Example ?? <div

Mark Mead 11 Dec 28, 2022