Debugging jQuery Isotope plugin
Hi there,
I'm working on a site in Wordpress that uses a theme that has the Isotope plugin implemented. This plugin allows users to sort content based on filters but the theme only supports sorting by one filter at a time. I've been trying to implement combining filters but I'm now a bit stuck.
Here is a JSFiddle by the plugin author on how to combine filters: http://isotope.metafizzy.co/index.html
And here is my demo where I'm trying this out: snaprockandpop.samcampsall.co.uk/shoots/
Here is my code for the function:
- $('.ql_filter a').click(function(){
var $this = $(this);
if ( $this.hasClass('active') ) {
return;
}
var $optionSet = $this.parents('.filter_list');
$optionSet.find('.active').removeClass('active');
$this.addClass('active');
var group = $optionSet.attr('data-filter-group');
filters[ group ] = $this.attr('data-filter');
var isoFilters = [];
for ( var prop in filters ) {
isoFilters.push( filters[ prop ] )
}
var selector = isoFilters.join('');
$container.isotope({ filter: selector });
return false;
});
What I can see by debugging in FireFox is that the function gets as far as passing the 'data-filter-group' attribute to the 'group' variable but then jumps out into the main jQuery script and doesn't come back! I've checked this behaviour in the JSFiddle, but in that example it just follows on through the script combining the filters. Any ideas as to why this is happening?
I've never done any JavaScript before, so I'm a bit stuck as to how to proceed. Any advice at all would be really welcome!