You should invert and pad your
data-value dates to
yyyymmdd format so that you can do comparisons on them:
- <div class="blocks" data-value="20130101">1</div>
- <div class="blocks" data-value="20130103">3</div>
- <div class="blocks" data-value="20130218">13</div>
- ...
Isotope only accepts a string filter, and none of the standard ones fit your requirements, so you'll need to define your own custom one:
- $.expr.filters.between = function(element, i, match) {
- var values = match[3].split('-');
- var value = $(element).data('value');
- return value >= values[0] && value <= values[1];
- }
Then use it like this:
- $container.isotope({
- filter: ':between(' + startDate + '-' + endDate + ')'
- });
See here for the
complete solution.