claviska/jQuery-notification — Issue #1: side effects of triggering click events
Author: spacedman
Created: 2011-12-27 14:08:47+00:00
State: open

I used this plugin to put up some notifications, but I noticed that a popup menu I was creating with jquery was disappearing when notifications disappeared.

Tracked it down - the popup menu disappears when you click off it, so there's a click event registered to $(document). But your notification script calls notification.trigger("click") when you timeout a notification, and this seems to cascade through to the document click event and my popup disappears when the notification fades out.

I think the solution is to not trigger a click event but to put the click event code into a function and call that from the real click event (.click handler) and whenever you want to simulate a click (ie reset the timeout and fade and remove the notification object).

I've got what I think is a working version but the change is pretty trivial and you can probably make a prettier job of it than me :)

Barry