When you call

$('.image-popup')

(with anything after the .) it will only apply to the elements that exist at that time. eg $('.image-popup').click(function() { alert("click"); }); will only put an event handler for those that exist so appending any new elements will not have that click handler (which is why we need to use event delegation for dynamically added elements).

The same applies here.

$('.image-popup').magnificPopup({

will tell magnificPopup only about the image-popups that exist at that time. When you add new ones later, it doesn't know about them.

So you need to recall your magnificPopup initialisation after you add the new elements.

Answer from fdomn-m on Stack Overflow
🌐
GitHub
github.com › dimsemenov › Magnific-Popup › issues › 985
Use Magnific Popup with AJAX-loaded content · Issue #985 · dimsemenov/Magnific-Popup
The only workaround for this that I know of is to use inline javascript on the AJAX-loaded content. I tried to do something like: <a class="test-popup-link" href="path-to-image.jpg" onclick="magnificPopup({type: 'image'}).magnificPopup('ope...
🌐
GitHub
github.com › dimsemenov › Magnific-Popup › issues › 794
Magnific-Popup not working after ajax sucess · Issue #794 · dimsemenov/Magnific-Popup
January 5, 2016 - It works perfectly fine when I load page, but when i filter my coupons with an ajax call it stops working and opens on a new page. Web Example: www.seansabour.net/coupons.php Click coupon image (Wo...
Author   seansabour
Discussions

jquery.magnific-popup not working when generated after ajax post
my problem is when i append to the div from jquery after ajax post the popup magnifier does not work at all i am using jquery.magnific-popup $(document).ready(function () { $('.image... More on stackoverflow.com
🌐 stackoverflow.com
March 8, 2018
Using magnific popup type ajax in form Submit
🌐 forum.jquery.com
Reload ajax magnific pop-up
$.magnificPopup.open({ items: {}, type: 'ajax', ajax: { settings: { url: some_url, cache:false, dataType: 'json', method: 'POST', data: params } }, key: 'basket_popup'}) ... C. GrahamC. Graham ... Is it better to redirect users who attempt to perform actions they can't yet... ... 2 Magnific Popup Not working properly when i try to call it on page load time or via onclick function · 2 Automatically close magnific Popup iframe after ... More on stackoverflow.com
🌐 stackoverflow.com
Specific content loaded via Ajax not working
I'm trying to load the content of a specific div of an external html file via "ajax", but I don't understand how to make it work. Here is what I'm doing: $(document).ready(fun... More on github.com
🌐 github.com
2
March 17, 2014
🌐
Dimsemenov
dimsemenov.com › plugins › magnific-popup › documentation.html
Magnific Popup Documentation
Internationalization of Magnific Popup is very simple, all you need is to extend default settings object with new values, or just pass options to your initialization code. If you’re making some public plugin or theme, it’s strongly recommended ...
🌐
GitHub
github.com › dimsemenov › Magnific-Popup › issues › 406
Specific content loaded via Ajax not working · Issue #406 · dimsemenov/Magnific-Popup
March 17, 2014 - I'm trying to load the content of a specific div of an external html file via "ajax", but I don't understand how to make it work. Here is what I'm doing: $(document).ready(function() { $('.n_link').magnificPopup({ type: 'ajax', modal: true, gallery:{enabled:true}, callbacks: { parseAjax: function(mfpResponse) { mfpResponse.data = $(mfpResponse.data).find('#pip'); console.log('Ajax content loaded:', mfpResponse); }, ajaxContentAdded: function() { console.log(this.content); } } }); });
Author   Animalejourbano
🌐
Stack Exchange
drupal.stackexchange.com › questions › 238389 › loading-an-ajax-form-through-ajax-magnific-popup
8 - Loading an Ajax form through Ajax (Magnific Popup) - Drupal Answers
June 14, 2017 - (function ($, Drupal) { 'use strict'; Drupal.behaviors.MemberPhotosGallery = { attach: function (context, settings) { $(window).on('hashchange', function () { var url = window.location.hash.substring(1); if (url == '/' || url == '') { $.magnificPopup.close(); } else if (url.substring(0, 6) == "/photo") { $.magnificPopup.open({ items: { src: url }, type: 'ajax', mainClass: 'mfp-zoom-out', showCloseBtn: true, closeOnBgClick: false, callbacks: { close: function () { window.location.hash = '/'; }, ajaxContentAdded: function () { var form = $('form#member-photo-edit')[0]; Drupal.attachBehaviors(form, settings); //# Triggering this doesn't ajaxify the Form.
Find elsewhere
🌐
Stack Overflow
stackoverflow.com › questions › 30276381 › magnific-popup-re-initiate-on-ajax-content
magnific-popup - re-initiate on ajax content - Stack Overflow
However, when loading some content using AJAX, MagnificPopup doesn't work anymore on those newly inserted elements - what am I missing. Any help is very much appreciated. ... What is the behavior i.e. message when it doesn't work? ... $( '.client-logo-overlay' ) only catches the elements which are already loaded when it's called. If you add new element later you have to call it again for these elements ... I was under the impression that if I'd use delegate: 'a' if would work...
🌐
GitHub
github.com › dimsemenov › Magnific-Popup › issues › 526
Opening popup from ajax loaded popup close both · Issue #526 · dimsemenov/Magnific-Popup
August 8, 2014 - Hi, i hava problems with opening popup from ajax content. ... <a href="/signin" onclick="$.magnificPopup.open({ closeBtnInside:true, closeOnContentClick:false, fixedBgPos:true, fixedContentPos:false, items:{src:this.href}, midClick:true, overflowY:'auto', removalDelay:'0', type:'ajax'}); return false;">Signin</a>
Author   wojto
🌐
Stack Overflow
stackoverflow.com › questions › 30533740 › magnific-popup-jquery-ajax-popup-is-not-working
Magnific Popup Jquery: Ajax Popup is not working
May 29, 2015 - <script type="text/javascript"> $(document).ready(function() { $('.ajax').magnificPopup({ delegate: 'a', type: 'ajax', alignTop: true, overflowY: 'scroll' // as we know that popup content is tall we set scroll overflow by default to avoid jump } } }); }); </script>
🌐
Stack Overflow
stackoverflow.com › questions › 47473705 › magnific-popup-not-working
javascript - Magnific-Popup Not Working
It seems that you have included both: <script src="magnific-popup/jquery.magnific-popup.js"></script> <script src="magnific-popup/jquery.magnific-popup.min.js"></script> ... replace this block of code in your code.
🌐
GitHub
github.com › dimsemenov › Magnific-Popup › issues › 1107
magnific popup ajax stopped when scrolling · Issue #1107 · dimsemenov/Magnific-Popup
January 26, 2019 - $(document).ready(function() { var ias = $.ias({ container: "#switchview", item: "article.post", pagination: ".posts-navigation", next: ".nav-previous a" }); var inumber = mainscript.infinitenumber; ias.extension(new IASSpinnerExtension({ html: '<div class="switch-loader"><span class="loader"></span></div>' // override text when no pages left })); // shows a spinner (a.k.a. loader) ias.extension(new IASTriggerExtension({offset: inumber})); // shows a trigger after page 3 ias.extension(new IASNoneLeftExtension({ html: '<div class="load-nomore"><span>There are no more pages left to load.</span></div>' // override text when no pages left })); }); ... $('.ajax-popup-link').magnificPopup({ type: 'ajax', callbacks: { parseAjax: function(mfpResponse) { mfpResponse.data = $(mfpResponse.data).find('.entry-content, .post-video'); console.log('Ajax content loaded:', mfpResponse); } } });
Author   aydcery