0

So i am trying to implement Masonry to Mageplaza InstaFeed Widget into a CMS page, but the code generated by the feed do not get Masonry working. Since If I copy the generated code once again into the CMS page Masonry do the job I guess the problem is with masonry waiting the images to be loaded, so I am implementing ImagesLoaded too, but with Bridget and Require it all become a mess to handle, so far this is the code, the console give no error:

<script type="text/javascript" xml="space">// <![CDATA[
requirejs( [ 'require', 'jquery', 'js/masonry.pkgd', 'js/imagesloaded', 'domReady!' ],
function( require, $, ImagesLoad, Masonry ) {
    require( [ 'jquery-bridget/jquery-bridget' ],
    function( jQueryBridget ) {
        jQueryBridget( 'masonry', Masonry, $ );

                    function initMasonry() {

                    var $grid = $('.instagrid');

                $grid.masonry({
            itemSelector: '.mpinstagramfeed-photo',
            percentPosition: true,
            columnWidth: '.grid-sizer'
        });

$grid.imagesLoaded().progress( function() {
    $grid.masonry('layout');
  });

    };
 });
});
// ]]></script>

but still no Masonry.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.