私は記事の見出しをたくさん持っており、それぞれに出典に応じたクラス名が付いています。サイトが読み込まれると、すべてのヘッドラインが表示されます。ソースはページの上部にリストされており、ユーザーがお気に入りのソースを選択できるように、Isotopeをクリックしたときにそれぞれを表示または非表示にします。
現状では、それらを削除しても問題ありませんが、それらを再び表示する方法がわかりません。
jQuery(function($){
var $container = $('.isotope-box');
$container.isotope({
masonry: {
columnWidth: 333,
cornerStampSelector: '.corner-stamp'
},
itemSelector: '#headlines'
});
// filter items when filter link is clicked
$('#filters a').click(function(){
$(this).toggleClass("active");
var selector = $(this).attr('data-filter');
var $removable = $container.find( selector );
$container.isotope( 'remove', $removable );
jQEvent.preventDefault();
});
$('#filters a.active').click(function(){
$(this).toggleClass("active");
var selector = $(this).attr('data-filter');
var $addition = $container.find( selector );
$container.isotope( 'insert', $addition );
jQEvent.preventDefault();
});
});
問題は「挿入」コードにあると思いますが、それがどのように機能するのかわかりません。Infinite Scrollも使用していますが、新しく追加したページを同じフィルターを使用して表示する必要があります。
助けてください!
マーティン