Lightweight Android-Style Toast Plugin with jQuery - m.toast

File Size: 4.87 KB
Views Total: 1463
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
   
Lightweight Android-Style Toast Plugin with jQuery - m.toast

m.toast is a really small jQuery plugin that displays a Android-style toast notification on your webpage that will destroy itself after a specified time.

How to use it:

1. Load jQuery m.toast plugin's file in your web project which has jQuery library installed.

<link rel="stylesheet" href="src/jquery.m.toast.css">
<script src="//code.jquery.com/jquery-1.11.2.min.js"></script>
<script src="src/jquery.m.toast.js"></script>

2. Display a default toast notification on your webpage.

$.toast('Hello world');

3. Pass in the available options to the toast notification during initialization.

$.toast('Hello world',{

  // how long the toast lasts
  'duration': 1000, 

  // blank, 'danger', 'info', 'success'
  'type': 'danger',

  // 500px
  width: 500,
  
  // top of bottom
  align: bottom,

  // Determines if only one toast in page or not
  singleton: true
  
});

Change log:

2017-05-29

  • Fixed width option

This awesome jQuery plugin is developed by kong-lo. For more Advanced Usages, please check the demo page or visit the official website.