I'm encountering an issue with an isotope filter menu. The goal is for it to load data based on a timestamp and allow filtering. However, there seems to be a conflict between my sortBy script and the filter script.
Below is the code in question:
Sort by code:
$('.showcase').isotope({
itemSelector: '.item',
getSortData: {
date: function ($elem) {
return $elem.attr('data-timestamp');
}
},
sortBy: 'date',
sortAscending: true,
masonry: {
columnWidth: 1
}
});
Filter menu code:
// filter container
var $container = $('.showcase');
$container.isotope({
itemSelector: '.thumb'
});
var $optionSets = $('.filter'),
$optionLinks = $optionSets.find('a');
$optionLinks.click(function () {
var $this = $(this);
// don't proceed if already selected
if ($this.hasClass('selected')) {
return false;
}
var $optionSet = $this.parents('.dropdown');
$optionSet.find('.selected').removeClass('selected');
$this.addClass('selected');
// dynamically create option object, e.g., { filter: '.my-filter-class' }
var options = {},
key = $optionSet.attr('data-option-key'),
value = $this.attr('data-option-value');
// parse 'false' as false boolean
value = value === 'false' ? false : value;
options[key] = value;
if (key === 'layoutMode' && typeof changeLayoutMode === 'function') {
// changes in layout modes require extra logic
changeLayoutMode($this, options)
} else {
// apply new options
$container.isotope(options);
}
return false;
});
Here is a working jsfiddle link: http://jsfiddle.net/3ngjL/2/
These two code blocks function independently, but fail to work together. Any insights or assistance would be greatly appreciated.