2013-01-11 20 views
0

我使用isotope.js來顯示圖像在一個簡單的cms,並且當一個圖像被刪除時,它會從列表中刪除圖像我打電話給reLayout方法:isotope.js reLayout方法不起作用,當刪除列表中的第一項時

$('.item').on('click',function(){ 
     $(this).remove(); 
     $('ul').isotope('reLayout'); 
    }); 

這適用於除列表中的第一項以外的每一項。

我複製這裏的問題:

http://jsfiddle.net/FgVLV/2/

誰能幫助我在這裏?我無法想象出我的生活!

回答

0
//#container_+id is container element 
$obj = $('#container_'+id); //VERY IMPORTANT! 

$('#container_'+id).animate({ 
    opacity: 0, 
    height: 'toggle'     
}, 1000, function() { 
    elem_isotope.isotope('remove', $obj); 
    $("#container_" + id).remove(); 
    $.when($("#container_" + id).remove()).then(elem_isotope.isotope('reLayout')); 

}); 
相關問題