我在我的项目包+ +无限滚动3中实现,但是当我滚动页面并加载新项目时,这些都不尊重包装。
var grid = document.querySelector('.masonry_base');
var pckry = new Packery( grid, {
itemSelector: '.post-grid',
percentPosition: true
});
// layout Packery after each image loads
imagesLoaded( grid ).on( 'progress', function() {
pckry.layout();
msnry.options.itemSelector = '.post-grid';
});
var elem = document.querySelector('.masonry_base');
var infScroll = new InfiniteScroll( elem, {
// options
path: '.next',
append: '.post-grid',
history: false,
});
如何确保每次通过无限负载加载新项目时,imagesLoaded load packery以对齐div?