dimsemenov / Magnific-Popup

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

Ajax Gallery next/prev problem #417

Open manfromanotherland opened 10 years ago

manfromanotherland commented 10 years ago

I found a bug in the ajax gallery implementation. When I click next (or prev) for the first time, works great, the content of the new popup is updated.

But when I click again to return to the prev item in gallery, doesn't work and stay in the current one.

Maybe this is a problem with my implementation, but I discover nothing on the web about it. Could it be a bug?

My code below:

$('.product-list').magnificPopup({
    delegate: 'a',
    type: 'ajax',
    gallery: {
        enabled: true,
        arrowMarkup: '<button title="%title%" type="button" class="my-mfp-arrow my-mfp-arrow-%dir%"></button>'
    },
    callbacks: {
        buildControls: function() {
            this.contentContainer.append(this.arrowLeft.add(this.arrowRight));
        },
        elementParse: function(item){
            postData = {
                postURL: $(item.el[0]).attr('data-url')
            }
            var mp = $.magnificPopup.instance;
            mp.st.ajax.settings.data = postData;
        }
    },
    ajax: {
        settings: {
            type: 'POST',
            url: 'popup.php'
        }
    }
});

Thanks for the help!

timur-orudzhov commented 9 years ago

i've encountered the same issue. edmundojr, did you find any solution ?

manfromanotherland commented 9 years ago

@timur-orudzhov Not that I remember man, sorry.