From f58d31260d884ef134b131f1fa661655a4765551 Mon Sep 17 00:00:00 2001 From: Ryan Oberholzer Date: Tue, 20 Mar 2012 16:03:45 +0200 Subject: [PATCH] Webkit browsers return NaN if padding attribute(s) are not set, causing isotope to stack elements on top of each other instead of positioning correctly. --- jquery.isotope.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/jquery.isotope.js b/jquery.isotope.js index 9ce0bae..8ad51f1 100644 --- a/jquery.isotope.js +++ b/jquery.isotope.js @@ -395,9 +395,12 @@ this.reloadItems(); // get top left position of where the bricks should be + var _paddingLeft = this.element.css('padding-left'); + var _paddingTop = this.element.css('padding-top'); + this.offset = { - left: parseInt( this.element.css('padding-left'), 10 ), - top: parseInt( this.element.css('padding-top'), 10 ) + left: parseInt( (_paddingLeft ? _paddingLeft : 0), 10 ), + top: parseInt( (_paddingTop ? _paddingTop : 0), 10 ) }; // add isotope class first time around