Toastr 2.0.1 is now released. You can grab it while its hot! This release has several minor bug fixes, CSS tweaks, some JavaScript refactoring, and some new features. Of course there are new unit tests for all of these too. There is 1 breaking change that I felt was in the best interest, which is why this is a new major version.

New Ways to Get Toastr

The Toastr demo page is also updated to show off some of the new features, most notably the animations and close button.

Note: CDNJS may be up to a few days before it is available there.

Animation Changes (Breaking)

The following animations options have been deprecated and should be replaced:

  • Replace options.fadeIn with options.showDuration
  • Replace options.onFadeIn with options.onShown
  • Replace options.fadeOut with options.hideDuration
  • Replace options.onFadeOut with options.onHidden

Animation Options (New)

Toastr will supply default animations, so you do not have to provide any of these settings. However you have the option to override the animations if you like.

Easings

Optionally override the animation easing to show or hide the toasts. Default is swing. swing and linear are built into jQuery.

toastr.options.showEasing = 'swing';
toastr.options.hideEasing = 'linear';

Using the jQuery Easing plugin (http://www.gsgd.co.uk/sandbox/jquery/easing/)

toastr.options.showEasing = 'easeOutBounce';
toastr.options.hideEasing = 'easeInBack';

Animation Method

Use the jQuery show/hide method of your choice. These default to fadeIn/fadeOut. The methods fadeIn/fadeOut, slideDown/slideUp, and show/hide are built into jQuery.

toastr.options.showMethod = 'slideDown'; 
toastr.options.hideMethod = 'slideUp';

Close Button (New)

Optionally enable a close button

toastr.options.closeButton = true;

Optionally override the close button’s HTML.

toastr.options.closeHtml 
    = '';

You can also override the CSS/LESS for #toast-container .toast-close-button

Display Sequence (New)

Show newest toast at bottom (top is default)

toastr.options.newestOnTop = false;

Thanks to the folks who contributed issues or pull requests to this release including: Ryan Hoffman, Jon Gallant, Jon Fazzaro, Craig Teegarden, Umberto, Raffi, Cesar Vargas, and Prashanfdo. (Sorry for any names I got wrong, I used the github user IDs).