Press "Enter" to skip to content

Pure Toast Notification JavaScript Library | Toastify JS

Toast Notification JavaScriptToastify JS is an easy, light-weight, vanilla JavaScript library used for sending stackable, non-blocking toast messages to end customers.

toast notification npm, toast notification jquery, toast notification example, toast notification js

Advantages:

  • Multiple notifications are stacked
  • Customizable
  • Not blocked from implementing the thread

A Lightweight Toast Notification Snack Bar Component | Mosha Vue Toastify

How to make use of it:

Import the principle JavaScript file ‘toastify.js’ into the HTML doc.

<script src="src/toastify.js"></script>

Create a primary toast message and specify the period in milliseconds to cover the notification.

var myToast = Toastify(
 text: "This is a toast message",
 duration: 5000
)

You are additionally allowed to load messages from a DOM node.

var myToast = Toastify()

Show the toast message. In this instance, the toast message will auto dismiss after 5 seconds.

myToast.showToast();

The default CSS for the toast message. Copy and paste the CSS kinds as displayed under your net web page.

.toastify 
  padding: 12px 20px;
  color: #ffffff;
  display: inline-block;
  box-shadow: 0 3px 6px -1px rgba(0, 0, 0, 0.12), 0 10px 36px -4px rgba(77, 96, 232, 0.3);
  background: -webkit-linear-gradient(315deg, #73a5ff, #5477f5);
  background: linear-gradient(135deg, #73a5ff, #5477f5);
  position: fixed;
  top: -150px;
  right: 15px;
  opacity: 0;
  transition: all 0.4s cubic-bezier(0.215, 0.61, 0.355, 1);
  border-radius: 2px;
  cursor: pointer;


.toastify.on { opacity: 1; }

Specify the container during which you wish to show the toast message.

myToast = Toastify()

Execute a callback perform as you click on the toast message.

myToast = Toastify({
  text: "This is a toast message",
  duration: 5000,
  onClick: function(){}
})

Execute a callback perform after the toast message is dismissed.

myToast = Toastify({
  text: "This is a toast message",
  duration: 5000,
  callback: function(){}
})

More configuration choices.

myToast = Toastify({
  // On-click destination
  destination: null,

  // Open destination in new window
  newWindow: false,

  // Show toast close icon
  close: false,

  // Toast position - top or bottom
  gravity: 'bottom',

  // Toast position - left or right
  positionLeft: false,
  position: 'left'

  // Background color
  backgroundColor: "linear-gradient(135deg, #73a5ff, #5477f5)",

  // Avatar
  avatar: "",

  // Additional classes for the toast
  classeName: ""

  // Prevents dismissing of toast on hover
  stopOnFocus: true,

  // Toast offset
  offset: { x: 0, y: 0 }
})

Simple Toast Notification Library, Toastify Pure JavaScript Library,  JS Toast Notification Libraries, Toastify Plugin/Github


See Demo And Download

Official Website(apvarun): Click Here

This superior jQuery/javascript plugin is developed by apvarun. For extra advanced usage, please go to the official website.

Be First to Comment

    Leave a Reply

    Your email address will not be published.