mirror of https://github.com/metafizzy/isotope
David DeSandro
14 years ago
7 changed files with 111 additions and 142 deletions
@ -0,0 +1,14 @@ |
|||||||
|
|
||||||
|
<h3>Filters</h3> |
||||||
|
|
||||||
|
<ul id="filters" class="option-set floated clearfix" data-option-key="filter"> |
||||||
|
<li><a href="#filter" data-option-value="*" class="selected">show all</a></li> |
||||||
|
<li><a href="#filter" data-option-value=".metal">metal</a></li> |
||||||
|
<li><a href="#filter" data-option-value=".transition">transition</a></li> |
||||||
|
<li><a href="#filter" data-option-value=".post-transition">post-transition</a></li> |
||||||
|
<li><a href="#filter" data-option-value=".nonmetal">nonmetal</a></li> |
||||||
|
<li><a href="#filter" data-option-value=".inner-transition">inner-transition</a></li> |
||||||
|
<li><a href="#filter" data-option-value=".alkali, .alkaline-earth">alkali and alkaline-earth</a></li> |
||||||
|
<li><a href="#filter" data-option-value=":not(.transition)">not transition</a></li> |
||||||
|
<li><a href="#filter" data-option-value=".metal:not(.transition)">metal but not transition</a></li> |
||||||
|
</ul> |
@ -0,0 +1,29 @@ |
|||||||
|
|
||||||
|
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; |
||||||
|
}); |
@ -1,25 +1,18 @@ |
|||||||
|
|
||||||
<h3>Sort</h3> |
<h3>Sort</h3> |
||||||
|
|
||||||
<ul id="sort" class="sort option-set"> |
<ul id="sort" class="sort option-set floated clearfix" data-option-key="sortBy"> |
||||||
<li> |
<li><a href="#sortBy=original-order" data-option-value="original-order" class="selected" data>original-order</a></li> |
||||||
<ul class="sort asc option-set floated clearfix"> |
<li><a href="#sortBy=name" data-option-value="name">name</a></li> |
||||||
<li><a href="#original-order" class="selected">original-order (asc)</a></li> |
<li><a href="#sortBy=symbol" data-option-value="symbol">symbol</a></li> |
||||||
<li><a href="#name">name (asc)</a></li> |
<li><a href="#sortBy=number" data-option-value="number">number</a></li> |
||||||
<li><a href="#symbol">symbol (asc)</a></li> |
<li><a href="#sortBy=weight" data-option-value="weight">weight</a></li> |
||||||
<li><a href="#number">number (asc)</a></li> |
<li><a href="#sortBy=category" data-option-value="category">category</a></li> |
||||||
<li><a href="#weight">weight (asc)</a></li> |
|
||||||
<li><a href="#category">category (asc)</a></li> |
|
||||||
</ul> |
</ul> |
||||||
</li> |
|
||||||
<li> |
<h3>Sort direction</h3> |
||||||
<ul class="sort desc option-set floated clearfix"> |
|
||||||
<li><a href="#original-order">original-order (desc)</a></li> |
<ul id="sort-direction" class="option-set floated clearfix" data-option-key="sortAscending"> |
||||||
<li><a href="#name">name (desc)</a></li> |
<li><a href="#sortAscending=true" data-option-value="true" class="selected">sort ascending</a></li> |
||||||
<li><a href="#symbol">symbol (desc)</a></li> |
<li><a href="#sortAscending=false" data-option-value="false">sort descending</a></li> |
||||||
<li><a href="#number">number (desc)</a></li> |
|
||||||
<li><a href="#weight">weight (desc)</a></li> |
|
||||||
<li><a href="#category">category (desc)</a></li> |
|
||||||
</ul> |
|
||||||
</li> |
|
||||||
</ul> |
</ul> |
Loading…
Reference in new issue