]> git.ipfire.org Git - thirdparty/foundation/foundation-sites.git/commitdiff
Modified Orbit to support reflow to allow for sizing recalculation when initially... 3829/head
authorSean Timm <sean@seantimm.com>
Mon, 6 Jan 2014 04:52:09 +0000 (21:52 -0700)
committerSean Timm <sean@seantimm.com>
Mon, 6 Jan 2014 04:52:09 +0000 (21:52 -0700)
js/foundation/foundation.orbit.js

index 515769a3756760399bebe5380b417e803f8d8cb2..cd93f63575ac8549358ff66efaac80f4030c4000 100644 (file)
     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();
+        });
+      }
     }
   };