Toastr 1.1.1 Available
posted by John with 10 comments
Just a few months ago Hans Fjällemark and I released toastr and since then we’ve had a lot of great feedback that we’ve worked into our free open source library. Toastr is a simple JavaScript toast notification library that is small, easy to use, and extendable. It allows you to create simple toasts with HTML5 and JavaScript like this:
Update: Version is now 1.1.1, since there was an API change (still backwards compatible) – added AMD support and version number.
Simply include the files in your HTML page and write a simple line of code like this:
toastr.success('Are you the six fingered man?', 'Inigo Montoya');
Click the this button to try it yourself.
Get the Latest Bits for toastr 1.1.1
You can grab the latest bits from NuGet or github
- Install toastr from NuGet
- Fork toastr on github
What’s New in 1.1.1
Today we finished the final changes for a new version of toastr (toastr 1.1.1). Here is a summary of the changes:
- Now supports AMD modules or non AMD modules (still backwards compatible)
- Added version property to return toastr’s version
console.log(toastr.version);
- Now requires jQuery 1.6.3 or later (formerly 1.7.2)
- Combined the 2 CSS files into 1 CSS file (contains all CSS and its media queries for responsive web design)
- Cleaned some outdated vendor prefixes in the CSS (thanks to Web Essentials 2012)
- New clear method to clear all toasts
toastr.clear();
- Added optionsOverride API to be able to override options for each toast,
var msg = 'Do you think Rodents of Unusual Size really exist?';
var title = 'Fireswamp Legends';
var overrides = {timeOut: 250};
toastr.warning(msg, title, overrides);
- Added onclick callback option which fires when a user clicks the toast.
toastr.options.onclick = function () {
alert('You can perform some custom action after a toast goes away');
}
toastr.info('Build a SPA');
Live Demo
Needs more information? Check out the readme on the github page for details on the simple API. You can also find a link to the live toastr demo on github or you can go directly to the toastr demo from here.
Rob Eisenberg on said:
Hey John! Great work. I really like this library. We are using it on RPGWithMe.com on our virtual game table to notify players of various realtime events such as player presence at the game table. It was really easy to drop in and the OOTB styles even worked well for us too. Thanks for the great work!
John on said:
Hi Rob,
Thanks, appreciate that. It’s nice ot know where toastr is being used. I’ll have to check out RPGWithme too … it sounds cool!
Binu Thayamkery on said:
Very Nice! Simple and clean. Loved it.
Doug Funk on said:
Thanks for the info John. Your sessions at DevConnections were really informative. Looking forward to building some SPAs.
André Baltieri on said:
Nice plugin. Easy to use and good UI.
Malisa Ncube on said:
Very nice plugin John.
Looking forward to using it in my next ASP.NET MVC project. I would love HtmlHelpers for it though. If you accept feature requests that would be my first.
Richard Bartley on said:
Simple and elegant. Using it here in UK for a client in the vehicle lease management industry.
Making use of the options.onclick functionality too – very useful.
Love the SPA work you are doing too, and the Pluralsight courses. Really opened my eyes to all the JavaScript frameworks, what’s possible and how to go about it.
Thanks.