From 33daf3691af98c27c91c9a255c632d17662f7e79 Mon Sep 17 00:00:00 2001 From: David DeSandro Date: Fri, 23 May 2014 15:16:13 -0400 Subject: [PATCH] add shuffle method; Ref #719 --- js/isotope.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/js/isotope.js b/js/isotope.js index c44df89..8da4cc2 100644 --- a/js/isotope.js +++ b/js/isotope.js @@ -549,6 +549,17 @@ function isotopeDefinition( Outlayer, getSize, matchesSelector, Item, LayoutMode } }; + Isotope.prototype.shuffle = function() { + // update random sortData + for ( var i=0, len = this.items.length; i < len; i++ ) { + var item = this.items[i]; + item.sortData.random = Math.random(); + } + this.options.sortBy = 'random'; + this._sort(); + this._layout(); + }; + /** * trigger fn without transition * kind of hacky to have this in the first place