【发布时间】:2015-07-16 16:50:09
【问题描述】:
我正在尝试将新项目插入同位素中的特定位置。基本上,当单击同位素项目时,我想在下一行的开头添加一个完整的容器宽度项目。它甚至可能是一个已经存在并被隐藏的项目。
这是我正在制作的小提琴:http://jsfiddle.net/AAnrX/62/。
$(function(){
var $container = $('.isotope');
var $checkboxes = $('#filters input');
// init isotope, then insert all items from hidden #alpha
$container.isotope({
itemSelector: '.item'
}).isotope();
$checkboxes.change(function(){
var filters = [];
// get checked checkboxes values
$checkboxes.filter(':checked').each(function(){
filters.push( this.value );
});
filters = filters.join(', ');
$container.isotope({ filter: filters });
});
$('#shuffle').click(function(){
$container.isotope('shuffle');
});
var $cell = $('.item');
$cell.click(function () {
$('#box').insertAfter('#first');
$container.isotope('reLayout');
});
});
基本上我所拥有的会改变项目在 DOM 中的位置,但这并不影响我猜同位素如何定位它。更改后我尝试了reLayout和layout,但运气不佳。
【问题讨论】:
-
你做到了吗?
标签: jquery-isotope