From 0eac5cc612247687c0d21ed7414fb9334697a1f9 Mon Sep 17 00:00:00 2001 From: David DeSandro Date: Mon, 19 Aug 2013 06:55:12 -0400 Subject: [PATCH] don't animate first filter --- isotope.js | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/isotope.js b/isotope.js index fa50517..65a620d 100644 --- a/isotope.js +++ b/isotope.js @@ -85,15 +85,18 @@ function isotopeDefinition( Outlayer, getSize, matchesSelector, Item, layoutMode }; Isotope.prototype.layout = function() { + // don't animate first layout + var isInstant = this._isInitInstant = this.options.isLayoutInstant !== undefined ? + this.options.isLayoutInstant : !this._isLayoutInited; + this.filteredItems = this._filter( this.items ); this._sort(); // Outlayer.prototype.layout.call( this ); this._resetLayout(); this._manageStamps(); - // don't animate first layout - var isInstant = this.options.isLayoutInstant !== undefined ? - this.options.isLayoutInstant : !this._isLayoutInited; + // var isInstant = this.options.isLayoutInstant !== undefined ? + // this.options.isLayoutInstant : !this._isLayoutInited; this.layoutItems( this.filteredItems, isInstant ); // flag for initalized @@ -133,8 +136,18 @@ function isotopeDefinition( Outlayer, getSize, matchesSelector, Item, layoutMode } } + // HACK + // disable transition on init + var _transitionDuration = this.options.transitionDuration; + if ( this._isInitInstant ) { + this.options.transitionDuration = 0; + } this.reveal( hiddenMatched ); this.hide( visibleUnmatched ); + // set back + if ( this._isInitInstant ) { + this.options.transitionDuration = _transitionDuration; + } return matches; };