Skip to content
/ noty Public

fix for animate.css#292

Merged
needim merged 1 commit intoneedim:masterfrom
r3wt:master
Aug 28, 2015
Merged

fix for animate.css#292
needim merged 1 commit intoneedim:masterfrom
r3wt:master

Conversation

@r3wt
Copy link
Contributor

@r3wt r3wt commented Aug 27, 2015

closes #265, #282 and #283
this fixes a problem where clicking a notification while it is being animated causes it to become uncloseable.

New behaviour creates a click event and binds it to self.$bar, setting property wasClicked

then, once animationEnd was emitted and noty has applied css and callbacks, a check is done to see if it the wasClicked property is set, and if it does it calls close(). works perfectly from what i have tested of it.

this fixes a problem where clicking a notification while it is being animated causes it to become uncloseable.
needim added a commit that referenced this pull request Aug 28, 2015
@needim needim merged commit ceb09f2 into needim:master Aug 28, 2015
@needim
Copy link
Owner

needim commented Aug 28, 2015

Nice, thanks. 👍

@r3wt
Copy link
Contributor Author

r3wt commented Aug 30, 2015

You're welcome, thanks for the great library

@Juanflu
Copy link

Juanflu commented Sep 16, 2015

Hi! first of all, thanks for the fix.
Anyway I also had to put your code inside the else block in order to make it work properly.

} else {
    self.$bar.on('click', function (e) {
        self.wasClicked = true;
    });
    self.$bar.animate(
        self.options.animation.open,
        self.options.animation.speed,
        self.options.animation.easing,
        function () {
            if (self.options.callback.afterShow) { self.options.callback.afterShow.apply(self); }
            self.showing = false;
            self.shown = true;
            if (self.hasOwnProperty('wasClicked')) {
                self.$bar.off('click', function (e) {
                    self.wasClicked = true;
                });
                self.close();
            }
        });
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BUG: alerts not closeable under certain circumstances

3 participants