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

AJAX popup inside popup. #1064

Closed julienbons closed 6 years ago

julienbons commented 6 years ago

Hi Y'all,

I'm having troubles finding a solution for opening an AJAX popup inside an AJAX popup. I'm using MFP for opening posts. I have 4 posts that shows more information when you click on it, by using AJAX functionality of MFP. Inside those popup with more information I'd like to those other posts. Nicest solution would be if it closes the first popup and re-opens the other. Does anybody have a solution for this? The code I'm using right now is very slim:

$('.js-ajax-popup').magnificPopup({ type: 'ajax', mainClass: 'mfp-fade', tLoading: 'Loading member of our team!', closeOnBgClick: false, removalDelay: 0, });

Thanks in advance!

julienbons commented 6 years ago

Add this:

$(document).on('click', '.js-link', function(e) { var url = $(this).attr('href').replace('http://your-url.com', ''); $.magnificPopup.close(); $.magnificPopup.open({ items: { src: url, type: 'ajax' } }); e.preventDefault(); });