Search code examples
jquerymagnific-popup

Magnific Popup: open new modal from existing modal


I am trying to implement the following:

I have login form displayed as a modal popup window (with Magnific Popup plugin). Inside this window I puted a link to open a new popup (registration form). And the problem is that as soon as user clicks on that link - the existing popup closed but new one does not appears.

The code for opeining popup:

  $.magnificPopup.open({
                items: {
                    src: name
                },
                type: 'inline',
                closeMarkup: '<button title="%title%" class="mfp-close">&times;</button>',
                preloader: false,
                fixedContentPos: true,
                fixedBgPos: true,
                overflowY: 'auto'
            });

Any suggestions please?

Thank you in advance


Solution

  • Add event.stopPropagation() in click event handler. Popup thinks that clicked element is outside of bounds, as you remove it after click by opening new popup.

    http://jsfiddle.net/DmitrySemenov/w4koj941/10/