Browse Source

_sort now falls back to original-order if comparing elements with equal values

pull/27/head
Luke L 14 years ago
parent
commit
5ca1571781
  1. 8
      jquery.isotope.js

8
jquery.isotope.js

@ -564,7 +564,13 @@
sortFn = function( alpha, beta ) {
var a = getSorter( alpha ),
b = getSorter( beta );
return ( ( a > b ) ? 1 : ( a < b ) ? -1 : 0 ) * sortDir;
if(a==b && instance.options.sortBy != 'original-order') {
a = $(alpha).data('isotope-sort-data')['original-order'];
b = $(beta).data('isotope-sort-data')['original-order'];
return ( ( a > b ) ? 1 : ( a < b ) ? -1 : 0 ) * sortDir;
} else {
return ( (a>b)?1:-1 ) * sortDir;
}
};
this.$filteredAtoms.sort( sortFn );

Loading…
Cancel
Save