【问题标题】:Isotope executing before Images load在图像加载之前执行同位素
【发布时间】:2017-04-29 06:18:26
【问题描述】:

我正在努力让我的 Isotope 在图像加载后执行,否则,Isotope 项目会重叠。 - 我正在尝试将 ImagesLoaded 插件 (http://imagesloaded.desandro.com/) 应用到我的 Isotope,但是,在图像加载后我正在努力执行 Isotope。

以下是我的未加载图像的同位素,如果有人知道该怎么做,我将不胜感激! (:这是我的同位素: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;
});

【问题讨论】:

  • 您在控制台中是否遇到任何错误?
  • 我已经为图像添加了一个最小高度值,似乎工作得更好,但不确定是否 100% 已修复。

标签: javascript jquery jquery-isotope imagesloaded


【解决方案1】:

对于imagesloaded,首先将脚本添加到您的页面,因为它不是同位素的一部分。然后按如下方式使用:

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2013-10-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多