我想根据html属性对同位素结果进行排序: HTML:
<div id="results">
<div data-order="1">Test 1</div>
<div data-order="2">Test 2</div>
<div data-order="1">Test 2</div>
</div>
使用Javascript:
var container = jQuery('#results');
container.isotope({
getSortData: {
order: '[data-order] parseInt'
},
sortBy: ['order']
});
当我按照https://isotope.metafizzy.co/sorting.html#sortby所述尝试时,它似乎对我不起作用。这是在我设置过滤器之后。
答案 0 :(得分:0)
我想出来了,我需要运行updateSortData函数来应用我的更改:
container.isotope('updateSortData').isotope();