mirror of https://github.com/metafizzy/isotope
Filter & sort magical layouts
http://isotope.metafizzy.co
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
867 B
30 lines
867 B
13 years ago
|
|
||
|
var $optionSets = $('#options .option-set'),
|
||
|
$optionLinks = $optionSets.find('a');
|
||
|
|
||
|
$optionLinks.click(function(){
|
||
|
var $this = $(this);
|
||
|
|
||
|
// don't proceed if already selected
|
||
|
if ( $this.hasClass('selected') ) {
|
||
|
return;
|
||
|
}
|
||
|
|
||
|
var $optionSet = $this.parents('.option-set');
|
||
|
|
||
|
$optionSet.find('.selected').removeClass('selected');
|
||
|
$this.addClass('selected');
|
||
|
|
||
|
// make option object dynamically, i.e. { 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;
|
||
|
|
||
|
$container.isotope( options );
|
||
|
|
||
|
return false;
|
||
|
});
|