View on GitHub

Jquery Toast Plugin

Jquery Toast Plugin

Hey fellas, jquery toast plugin, as the name specifies, is the jquery plugin that lets you show beautiful toast messages to the user with haste.

It provides the user with a ton (please don't go and start counting them) of options. Below are some of the features of the plugin

Basic Demos

Before I go into the detail of plugin, have a look at the following quick demos:

To reset/remove any toast you can do the following:

var myToast = $.toast('Some toast that needs to be removed.');
myToast.reset(); // remove the toast "Some toast that needs to be removed"

What if I want to reset all the toasts at once? You may ask. Well in that case, you can do the following:

$.toast().reset('all');

Features

Customize Plugin

Generate


$.toast({
    text: "Hey there fellas, here is a simple toast. Change the options above and then see the code that generates that toast", // Text that is to be shown in the toast
    heading: 'How to use', // Optional heading to be shown on the toast
    showHideTransition: 'fade', // fade, slide or plain
    allowToastClose: true, // Boolean value true or false
    hideAfter: 3000, // false to make it sticky or number representing the miliseconds as time after which toast needs to be hidden
    stack: 5, // false if there should be only one toast at a time or a number representing the maximum number of toasts to be shown at a time
    position: 'bottom-left', // bottom-left or bottom-right or bottom-center or top-left or top-right or top-center or mid-center or an object representing the left, right, top, bottom values
    position: { left : 20, right : 20, top : 20, bottom : 20 }, // bottom-left or bottom-right or bottom-center or top-left or top-right or top-center or mid-center or an object representing the left, right, top, bottom values
    bgColor: '#444',  // Background color of the toast
    textColor: '#eee',  // Text color of the toast
    textAlign: 'left',  // Text alignment i.e. left, right or center
    beforeShow: function () {}, // will be triggered before the toast is shown
    afterShown: function () {}, // will be triggered after the toat has been shown
    beforeHide: function () {}, // will be triggered before the toast gets hidden
    afterHidden: function () {}  // will be triggered after the toast has been hidden
});