equal
deleted
inserted
replaced
|
1 |
|
2 var $optionSets = $('#options .option-set'), |
|
3 $optionLinks = $optionSets.find('a'); |
|
4 |
|
5 $optionLinks.click(function(){ |
|
6 var $this = $(this); |
|
7 // don't proceed if already selected |
|
8 if ( $this.hasClass('selected') ) { |
|
9 return false; |
|
10 } |
|
11 var $optionSet = $this.parents('.option-set'); |
|
12 $optionSet.find('.selected').removeClass('selected'); |
|
13 $this.addClass('selected'); |
|
14 |
|
15 // make option object dynamically, i.e. { filter: '.my-filter-class' } |
|
16 var options = {}, |
|
17 key = $optionSet.attr('data-option-key'), |
|
18 value = $this.attr('data-option-value'); |
|
19 // parse 'false' as false boolean |
|
20 value = value === 'false' ? false : value; |
|
21 options[ key ] = value; |
|
22 if ( key === 'layoutMode' && typeof changeLayoutMode === 'function' ) { |
|
23 // changes in layout modes need extra logic |
|
24 changeLayoutMode( $this, options ) |
|
25 } else { |
|
26 // otherwise, apply new options |
|
27 $container.isotope( options ); |
|
28 } |
|
29 |
|
30 return false; |
|
31 }); |