"; page.document.write(html); } else { $(this).find('video')[0].play(); } } // init Masonry var $grid = $('.grid').masonry({ // options... itemSelector: '.item1', isFitWidth: true, columnWidth: 1, initLayout: false }); // layout Masonry after each image loads $grid.imagesLoaded().progress( function() { $grid.masonry('layout'); });