From 76276c506cb771721cd0eec0503c7d09308ff4a8 Mon Sep 17 00:00:00 2001 From: Sean Timm Date: Sun, 5 Jan 2014 21:52:09 -0700 Subject: [PATCH] Modified Orbit to support reflow to allow for sizing recalculation when initially hidden --- js/foundation/foundation.orbit.js | 41 ++++++++++++++++++++++--------- 1 file changed, 29 insertions(+), 12 deletions(-) diff --git a/js/foundation/foundation.orbit.js b/js/foundation/foundation.orbit.js index 515769a37..cd93f6357 100644 --- a/js/foundation/foundation.orbit.js +++ b/js/foundation/foundation.orbit.js @@ -412,21 +412,38 @@ init: function (scope, method, options) { var self = this; - if (typeof method === 'object') { - $.extend(true, self.settings, method); - } + this.bindings(method, options); + }, + + events : function () { + var self = this; - if ($(scope).is('[data-orbit]')) { - var $el = $(scope); - var opts = self.data_options($el); - new Orbit($el, $.extend({},self.settings, opts)); + if ($(self.scope).is('[data-orbit]')) { + var $el = $(self.scope); + $el.data(self.name + '-instance', new Orbit($el, $el.data('orbit-init'))); + } else { + $('[data-orbit]', self.scope).each(function(idx, el) { + var $el = $(el); + $el.data(self.name + '-instance', new Orbit($el, $el.data('orbit-init'))); + }); } + }, - $('[data-orbit]', scope).each(function(idx, el) { - var $el = $(el); - var opts = self.data_options($el); - new Orbit($el, $.extend({},self.settings, opts)); - }); + reflow : function () { + var self = this; + + if ($(self.scope).is('[data-orbit]')) { + var $el = $(self.scope); + var instance = $el.data(self.name + '-instance'); + instance.compute_dimensions(); + } else { + $('[data-orbit]', self.scope).each(function(idx, el) { + var $el = $(el); + var opts = self.data_options($el); + var instance = $el.data(self.name + '-instance'); + instance.compute_dimensions(); + }); + } } }; -- 2.47.2