【问题标题】:ISOTOPE: Sort by a category and by dateISOTOPE:按类别和日期排序
【发布时间】:2012-03-28 04:38:38
【问题描述】:

我正在使用 ISOTOPE 并有 6 个类别。每个类别都有任意数量的帖子。

我有一个指向每个类别的链接列表,当单击类别名称时(例如:艺术家)我需要将该艺术家类别中的所有框移到顶部并按日期排序,最近的框首先显示.

在我的 JS 文件中,我有这个:

$container.isotope({
    itemSelector : '.module',
    getSortData : {
      artists : function( $elem ) {
        return $elem.attr('artists');
      }
    }
  });

我的 HTML 如下所示:

<div class="module artists" data-category="artists">
<p class="date">01/02/12</p>
<img src="../url.jpg" />
<p>Link title</p>
</div>

这段代码似乎没有按照我想要的方式对其进行排序,也不知道如何调整它,有人可以帮忙吗?

【问题讨论】:

标签: jquery sorting posts jquery-isotope


【解决方案1】:

这就是我真正需要做的:

getSortData : {
  blogs : function( $elem ) {
    var isBlog = $elem.hasClass('blogs');
    return (isBlog?' ':'') + $elem.find('.date').text();
  }
}

完整答案请查看这篇文章:Isotope: Select and display .xx class at the top

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2015-02-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多