0

我正在使用以下同位素实现在我的 wordpress 网站上包含一个同位素网格,该网格使用三个选择菜单按标签过滤。这一切都很好,但谁能给我一些关于添加 BBQ 插件的指导,使我能够链接到来自其他页面的预定义过滤器。我尝试了一些变体,但不确定如何在 BBQ 旁边使用我现有的代码。谢谢你们的帮助!

jQuery(function ($) {

var $container = $('#isotope-list'); //The ID for the list with all the blog posts
$container.isotope({ //Isotope options, 'item' matches the class in the PHP
    itemSelector : '.item', 
    layoutMode : 'fitRows',

});

//Add the class selected to the item that is clicked, and remove from the others
var $optionSets = $('.group'),
$optionLinks = $optionSets.find('option');

$optionLinks.click(function(){
var $this = $(this);
// don't proceed if already selected
if ( $this.hasClass('selected') ) {
  return false;
}
var $optionSet = $this.parents('.group');
$optionSets.find('.selected').removeClass('selected');
$this.addClass('selected');

//When an item is clicked, sort the items.
 var selector = $(this).attr('data-filter');
$container.isotope({ filter: selector });

return false;
});

});
4

0 回答 0