2016-12-14 26 views
0

我努力讓圖像加載後執行我的同位素,因爲否則,同位素項目會重疊。 - 我試圖將ImagesLoaded插件(http://imagesloaded.desandro.com/)應用於我的同位素,但是,我正努力在圖像加載後執行同位素。同位素在圖像加載之前執行

下面是我的Isotope WITHOUT ImagesLoaded,如果有人知道如何去做這件事,我將不勝感激! (:這是我在行動同位素:http://illuminategg.hol.es/portfolio.html

var isotope_port = $('.port-isotope'); 
isotope_port.isotope({ 
    'itemSelector': '.item' 
}); 

$('.port-filter a').click(function() { 
    $(this).parent().parent().find('li').removeClass('selected'); 
    $(this).parent().addClass('selected'); 

    var selector = $(this).attr('data-filter'); 
    isotope_port.isotope({ filter: selector }); 
    return false; 
}); 
+0

難道您在控制檯中出現任何錯誤? – Viney

+0

我已經爲圖像添加了最小高度值,似乎運行得更好,不知道是否100%固定。 – Meowls

回答

0

對於imagesloaded,首先將腳本添加到您的網頁,因爲它不是同位素的一部分,那麼按如下方式使用它:

var isotope_port = $('.port-isotope'); isotope_port.imagesLoaded(function() { isotope_port.isotope({ 'itemSelector': '.item' }); });

相關問題