Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reinitialize Magnific Popup on infinite scroll callback? #584

Closed
lsterling03 opened this issue Nov 25, 2014 · 1 comment
Closed

Reinitialize Magnific Popup on infinite scroll callback? #584

lsterling03 opened this issue Nov 25, 2014 · 1 comment

Comments

@lsterling03
Copy link

I am using Magnific Popup and Infinite Scroll. The popup only works on the first "page" and does not work after I click to load more posts. I need to re-initialize Magnific inside the Infinite Scroll callback after new posts are appended.

Is there a re-initialization code I can use in this callback, or do I have to duplicate all of my original initialization codes and paste them into the callback?

Thank you!

@lsterling03
Copy link
Author

NVM. I solved this by putting all my original init codes into one function like so:

var bsPopup = function() {

    $('.imagepop').magnificPopup({
    type: 'image'
    });

    $('.ajaxpop').magnificPopup({
    type: 'ajax',
    callbacks: {
    parseAjax: function(mfpResponse) {
        mfpResponse.data = $(mfpResponse.data).find('#masthead');
        console.log('Ajax content loaded:', mfpResponse);
    }
    }
   });

};

And then I just called bsPopup() in the Infinite Scroll callback.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant