Magnific popup and infinite scrolling

2019-08-10 09:12发布

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

1条回答
趁早两清
2楼-- · 2019-08-10 10:09

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*/});
});
查看更多
登录 后发表回答