dimsemenov / Magnific-Popup

Light and responsive lightbox script with focus on performance.
http://dimsemenov.com/plugins/magnific-popup/
MIT License
11.39k stars 3.48k forks source link

Popup ignores setTimeout on second load #958

Closed pat-sullivan closed 7 years ago

pat-sullivan commented 7 years ago

I have dynamically created galleries on a bunch of pages on a site using the same function. The main image at the top of the page is where the issue occurs.

I have a 50% wide div with a background image... when a user clicks the image, the div grows to 100%, and after a delay, the popup plugin loads the gallery.

Everything works beautifully the first time, but if you close the popup and click it again, it ignores the setTimeout function and just opens the plugin immediately. If I view in dev tools, I can see the div growing with transition correctly.

Any ideas?

Example: http://bayaveplantco.com/outdoor-living/

Code: popup-snippet.js.zip

ghost commented 7 years ago

This doesn't seem directly related to Magnific-Popup - but is an interesting issue.

Can you replicate the issue on a codepen with unminified JS?