Question

I've got an jquery isoptope that I filter with checkboxes. The value of the checkboxes are retrieved with jquery cookie and I want to set the initial filter using the values of the checkboxes. I've made a jsfiddle: http://jsfiddle.net/qdzcP/10/

I'm creating a new variable

var initfilter = [];
$checkboxes.filter(':checked').each(function(){
  initfilter.push( this.value );
});
initfilter = initfilter.join(', ');

and then loading the variable as a filter when I load isotope

$container.isotope({
    itemSelector: '.item',
    filter: 'initfilter'
});

However it seems that the filter that initialises is not correct. Could someone point me in the right direction?

Thanks a lot!

Was it helpful?

Solution

You are assigning filter a string value of initfilter. Remove the quotes to use the variable

filter: initfilter

FIDDLE

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top