Using masonry with imagesloaded

前端 未结 3 931
清酒与你
清酒与你 2020-12-03 05:42

I\'m a js newbie and hope this questions doesn\'t seem too stupid.

I\'m using masonry for my site - works fine. I wanted to let my boxes appear just when masonry fin

3条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-03 06:26

    Another solution is to initialize Masonry inside $(window).load() instead of $(document).ready(). This will trigger Masonry after all the media on the page has loaded – images, fonts, external scripts and stylesheets, etc.

    $(window).load(function(){
        $('#container').masonry({
            // options...
        });
    });
    

提交回复
热议问题