Skip to content

Sometimes, you just want your toast to bounce. You know? #86

Closed
wants to merge 6 commits into from

2 participants

@jonfazzaro

I've added options to specify show/hide methods and easing, rather than just using fadeIn/fadeOut. For example:

    toastr.options = {
        positionClass: "toast-top-full-width",
        showMethod: 'slideDown',
        showEasing: 'easeOutBounce',
        showDuration: 'fast',
        hideMethod: 'slideUp',
        hideEasing: 'easeInBack',
        hideDuration: 'fast',
        newestOnTop: false
    }
@johnpapa
CodeSeven member

I like the idea of adding more animation support. But I', not a fan of changing the API and making a breaking change. If you can think of a way to refactor this to make it an additive change and not break existing code, I'll consider it. And of course, and unit tests.

@jonfazzaro

Excellent point. I have restored the removed "fade" options, and added code to the getOptions function to synchronize them with the newer ones. And of course, I added back the unit tests that exercised them.

@johnpapa johnpapa added a commit that closed this pull request Aug 30, 2013
@johnpapa johnpapa Updated for v 2.0.0rc1. ## Breaking Changes
Closes #86 and Closes #107

####Animation Changes
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
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';
29fcfcb
@johnpapa johnpapa closed this in 29fcfcb Aug 30, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.