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:
-
Simple non sticky fade transitioned toast using some random text
$.toast("Lorem ipsum dolor sit amet, consectetur adipisicing elit. Hic, consequuntur doloremque eveniet eius eaque dicta repudiandae illo ullam. Minima itaque sint magnam dolorum asperiores repudiandae dignissimos expedita, voluptatum vitae velit.")
...sticky fade transitioned toast using some random text
$.toast({ text : "Lorem ipsum dolor sit amet, consectetur adipisicing elit. Hic, consequuntur doloremque eveniet eius eaque dicta repudiandae illo ullam. Minima itaque sint magnam dolorum asperiores repudiandae dignissimos expedita, voluptatum vitae velit.", hideAfter : false })
...non sticky fade transitioned toast using some HTML
$.toast("Let's test some HTML stuff... <a href='#'>github</a>")
...sticky fade transitioned toast using some HTML and CSS
$.toast({ text : "<strong>Remember!</strong> You can <span style='font-weight: bold; color:red;' class='horribly-styled'>always</span> introduce your own × HTML and <span style='font-size: 18px;'>CSS</span> in the toast.", hideAfter : false })
...non sticky fade transitioned toast using an array
$.toast(["Ubuntu : One of it's kind", "Sublime Text : Productivity unleashed", "HeidiSQL : Just love it", "Github : Just Lovely"])
...sticky fade transitioned toast using an array
$.toast({ text : ["Ubuntu : One of it's kind", "Sublime Text : Productivity unleashed", "HeidiSQL : Just love it", "Github : Just Lovely"], hideAfter : false })
...non sticky slide transitioned toast through
$.toast({ text : "Let's test some HTML stuff... <a href='#'>github</a>", showHideTransition : 'slide' })
...sticky slide transitioned toast through
$.toast({ text : "Lorem ipsum dolor sit amet, consectetur adipisicing elit. Ab ad molestias illo illum, modi, velit, excepturi, commodi ipsum itaque deserunt voluptates reprehenderit ipsa suscipit optio rem voluptate assumenda fuga explicabo.", showHideTransition : 'slide', hideAfter : false })
...non sticky slide transitioned toast using array
$.toast({ text : ["Ubuntu : One of it's kind", "Sublime Text : Productivity unleashed", "HeidiSQL : Just love it", "Github : Just Lovely"], showHideTransition : 'slide' })
...sticky slide transitioned toast using array plus different formatting
$.toast({ text : ["Ubuntu : One of it's <strong>kind</strong>", "Sublime Text : Productivity unleashed", "HeidiSQL : Just love it", "Github : Just Lovely"], showHideTransition : 'slide', hideAfter : false, bgColor : 'blue', textColor : '#eee' })
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
- Custom toast background color and text color
- Ability to hack the CSS to add your own thing
-
Text can be provided in the form of
- Array (It's elements will be changed to an un ordered list)
- ..text
- HTML
- Events support i.e.
beforeHide
,afterHidden
,beforeShow
,afterShown
Fade
andSlide
show/hide transitions support (More to come)- You can position the toast, wherever you want there is support for
top-left
,top-right
bottom-left
and bottom-right,top-center
,bottom-center
andmid-center
...sighs! That's a whole lot of options, isn't it? No, you say. Ok then here is the most exciting thing, you can also introduce your own positioning just by passing a simple js object containing{ top: - , bottom: -, left: -, right: - }
- Ability to add sticky toast
- Optional stack length can be defined (i.e. maximum number of toasts that can be shown at once)