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

Popups won't open from within open popups #596

Open ghost opened 9 years ago

ghost commented 9 years ago

So I want to open something but the trigger to open that popup is located within another mfp popup... Right now it doesn't work in production, but take a look around line 223 and put this instead:

if(mfp._checkIfClose(e.target) && !mfp.isOpen) {

This will make sure you can open pop-ups from within the popup instance, no matter what.

Keep it up, it's a good plugin!

Take care.

ghost commented 9 years ago

Just realized that it breaks the "click on foreground to close the popup"; Looking how to make my fix less destructive.

ghost commented 9 years ago

The way I solved it for now in my code is by using e.stopPropogation(); on the links which are placed inside the pop-ups, to open another mfp instance. This way the overlay click still works; The code still needs to be revamped though, there's an obvious issue with opening popups from withing a currently open popup.