1

I have a tumblr blog whit infine scrolling and magnific-popup to visualize the image.

When I scroll to the bottom and load new posts, magnific-popup doesn't works in the new posts loaded but only in the old.

If I try to go to "page-2" manually everything works.

Is there a way to reload magnific-popup on load posts or something similar?

Many thanks

2 Answers2

1

All you need to do is call the .magnificPopup method on the new elements when infinitescroll is loaded, this way:

$YOUR_CONTAINER.infinitescroll({
    navSelector:  ".Pagination",
    nextSelector: ".Pagination-next",
    itemSelector: ".Post"
}, function( newElements ) {
    $(newElements).magnificPopup({/*your options here*/});
});
fregante
  • 29,050
  • 14
  • 119
  • 159
0

You can use onInit event for callback function. See more

Example code:

$('.your-class-name').infiniteScroll({
    // options
    path: '.next.page-numbers',
    append: '.post',
    history: false,
    status: '.page-load-status',
    button: '.page-load-more',
    loadOnScroll: false,
    elementScroll: true,
    hideNav: '.post-pagination',
    onInit: function() {
        this.on( 'append', function() {
            $('.your-item-class-name').magnificPopup({
                /* magnificPopup options here */
            });
        });
    }
});
Rubel Miah
  • 171
  • 2
  • 6