sciactive / pnotify

Beautiful JavaScript notifications with Web Notifications support.
https://sciactive.com/pnotify/
Apache License 2.0
3.65k stars 513 forks source link

Delay does not begin until mouse over. #230

Closed sstiglitz closed 6 years ago

sstiglitz commented 8 years ago

Steps to recreate:

Create a new PNotify object using the following

new PNotify({ styling: "bootstrap3", title: false, text: 'Contract Date Saved. You can still print your docs by clicking here.', width: "100%", type: "success", buttons: { sticker: false }, stack: stack_bar_bottom, delay: 1000, shadow: false });

Expected result: The notice fades out after 1 second.

Actual result The notice does not fade out. Interesting note - if you mouse over the notice, it will fade out after 1 second.

As far as I can tell, it is getting stuck in a loop within the callback function of animateIn. This is because the top-level element never really is visible and so it just continues looping through due to the setTimeout.

h3llrais3r commented 8 years ago

I'm having the same problem. I have the impression it's related to the callback inside the animateIn fuction. https://github.com/sciactive/pnotify/blob/master/src/pnotify.js#L506-L522 If I remove this part, it seems to work, but I'm not sure this is the solution because it might break something else...

h3llrais3r commented 8 years ago

Another way to fix this, is replacing the code at line: https://github.com/sciactive/pnotify/blob/master/src/pnotify.js#L513 by if (that.elem.css("opacity") != "0" || that.elem.is(":visible")) { I based myself on the animateOut function... Hopefully this is the correct fix?

hperrin commented 6 years ago

Hmm. Why would jQuery's :visible pseudoclass not work in this case? That's weird. Anyway, this is fixed in develop (v4).