2018-05-05 13:35:10 +00:00
|
|
|
/*! UIkit 2.27.4 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
|
2016-03-06 00:50:22 +00:00
|
|
|
(function(UI) {
|
|
|
|
|
|
|
|
"use strict";
|
|
|
|
|
|
|
|
var grids = [];
|
|
|
|
|
|
|
|
UI.component('gridMatchHeight', {
|
|
|
|
|
|
|
|
defaults: {
|
2018-05-05 13:35:10 +00:00
|
|
|
target : false,
|
|
|
|
row : true,
|
|
|
|
ignorestacked : false,
|
|
|
|
observe : false
|
2016-03-06 00:50:22 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
boot: function() {
|
|
|
|
|
|
|
|
// init code
|
|
|
|
UI.ready(function(context) {
|
|
|
|
|
2018-05-05 13:35:10 +00:00
|
|
|
UI.$('[data-uk-grid-match]', context).each(function() {
|
2016-03-06 00:50:22 +00:00
|
|
|
var grid = UI.$(this), obj;
|
|
|
|
|
2018-05-05 13:35:10 +00:00
|
|
|
if (!grid.data('gridMatchHeight')) {
|
|
|
|
obj = UI.gridMatchHeight(grid, UI.Utils.options(grid.attr('data-uk-grid-match')));
|
2016-03-06 00:50:22 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
|
|
|
init: function() {
|
|
|
|
|
|
|
|
var $this = this;
|
|
|
|
|
|
|
|
this.columns = this.element.children();
|
|
|
|
this.elements = this.options.target ? this.find(this.options.target) : this.columns;
|
|
|
|
|
|
|
|
if (!this.columns.length) return;
|
|
|
|
|
|
|
|
UI.$win.on('load resize orientationchange', (function() {
|
|
|
|
|
|
|
|
var fn = function() {
|
2018-05-05 13:35:10 +00:00
|
|
|
if ($this.element.is(':visible')) $this.match();
|
2016-03-06 00:50:22 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
UI.$(function() { fn(); });
|
|
|
|
|
|
|
|
return UI.Utils.debounce(fn, 50);
|
|
|
|
})());
|
|
|
|
|
2018-05-05 13:35:10 +00:00
|
|
|
if (this.options.observe) {
|
|
|
|
|
|
|
|
UI.domObserve(this.element, function(e) {
|
|
|
|
if ($this.element.is(':visible')) $this.match();
|
|
|
|
});
|
|
|
|
}
|
2016-03-06 00:50:22 +00:00
|
|
|
|
2018-05-05 13:35:10 +00:00
|
|
|
this.on('display.uk.check', function(e) {
|
|
|
|
if(this.element.is(':visible')) this.match();
|
2016-03-06 00:50:22 +00:00
|
|
|
}.bind(this));
|
|
|
|
|
|
|
|
grids.push(this);
|
|
|
|
},
|
|
|
|
|
|
|
|
match: function() {
|
|
|
|
|
2018-05-05 13:35:10 +00:00
|
|
|
var firstvisible = this.columns.filter(':visible:first');
|
2016-03-06 00:50:22 +00:00
|
|
|
|
|
|
|
if (!firstvisible.length) return;
|
|
|
|
|
|
|
|
var stacked = Math.ceil(100 * parseFloat(firstvisible.css('width')) / parseFloat(firstvisible.parent().css('width'))) >= 100;
|
|
|
|
|
|
|
|
if (stacked && !this.options.ignorestacked) {
|
|
|
|
this.revert();
|
|
|
|
} else {
|
|
|
|
UI.Utils.matchHeights(this.elements, this.options);
|
|
|
|
}
|
|
|
|
|
|
|
|
return this;
|
|
|
|
},
|
|
|
|
|
|
|
|
revert: function() {
|
|
|
|
this.elements.css('min-height', '');
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
UI.component('gridMargin', {
|
|
|
|
|
|
|
|
defaults: {
|
2018-05-05 13:35:10 +00:00
|
|
|
cls : 'uk-grid-margin',
|
|
|
|
rowfirst : 'uk-row-first'
|
2016-03-06 00:50:22 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
boot: function() {
|
|
|
|
|
|
|
|
// init code
|
|
|
|
UI.ready(function(context) {
|
|
|
|
|
2018-05-05 13:35:10 +00:00
|
|
|
UI.$('[data-uk-grid-margin]', context).each(function() {
|
2016-03-06 00:50:22 +00:00
|
|
|
var grid = UI.$(this), obj;
|
|
|
|
|
2018-05-05 13:35:10 +00:00
|
|
|
if (!grid.data('gridMargin')) {
|
|
|
|
obj = UI.gridMargin(grid, UI.Utils.options(grid.attr('data-uk-grid-margin')));
|
2016-03-06 00:50:22 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
|
|
|
init: function() {
|
|
|
|
|
|
|
|
var stackMargin = UI.stackMargin(this.element, this.options);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2018-05-05 13:35:10 +00:00
|
|
|
})(UIkit2);
|