vendor/assets/javascripts/uikit/core/utility.js in uikit2-rails-0.1.4 vs vendor/assets/javascripts/uikit/core/utility.js in uikit2-rails-0.1.5

- old
+ new

@@ -1,16 +1,17 @@ -/*! UIkit 2.24.2 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */ +/*! UIkit 2.24.3 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */ (function(UI) { "use strict"; var stacks = []; UI.component('stackMargin', { defaults: { - 'cls': 'uk-margin-small-top' + cls: 'uk-margin-small-top', + rowfirst: false }, boot: function() { // init code @@ -58,12 +59,27 @@ stacks.push(this); }, process: function() { + var $this = this; + this.columns = this.element.children(); UI.Utils.stackMargin(this.columns, this.options); + + if (!this.options.rowfirst) { + return this; + } + + // Mark first column elements + var pos_cache = this.columns.removeClass(this.options.rowfirst).filter(':visible').first().position(); + + if (pos_cache) { + this.columns.each(function() { + UI.$(this)[UI.$(this).position().left == pos_cache.left ? 'addClass':'removeClass']($this.options.rowfirst); + }); + } return this; }, revert: function() {