2 lines
3.3 KiB
JavaScript
2 lines
3.3 KiB
JavaScript
/*! UIkit 2.25.0 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
|
|
!function(t){"use strict";var i=[];t.component("stackMargin",{defaults:{cls:"uk-margin-small-top",rowfirst:!1},boot:function(){t.ready(function(i){t.$("[data-uk-margin]",i).each(function(){var i=t.$(this);i.data("stackMargin")||t.stackMargin(i,t.Utils.options(i.attr("data-uk-margin")))})})},init:function(){var n=this;t.$win.on("resize orientationchange",function(){var i=function(){n.process()};return t.$(function(){i(),t.$win.on("load",i)}),t.Utils.debounce(i,20)}()),t.$html.on("changed.uk.dom",function(){n.process()}),this.on("display.uk.check",function(){this.element.is(":visible")&&this.process()}.bind(this)),i.push(this)},process:function(){var i=this,n=this.element.children();if(t.Utils.stackMargin(n,this.options),!this.options.rowfirst)return this;var s=n.removeClass(this.options.rowfirst).filter(":visible").first().position();return s&&n.each(function(){t.$(this)[t.$(this).position().left==s.left?"addClass":"removeClass"](i.options.rowfirst)}),this}}),function(){var i=[],n=function(t){if(t.is(":visible")){var i=t.parent().width(),n=t.data("width"),s=i/n,e=Math.floor(s*t.data("height"));t.css({height:n>i?e:t.data("height")})}};t.component("responsiveElement",{defaults:{},boot:function(){t.ready(function(i){t.$("iframe.uk-responsive-width, [data-uk-responsive]",i).each(function(){var i,n=t.$(this);n.data("responsiveElement")||(i=t.responsiveElement(n,{}))})})},init:function(){var t=this.element;t.attr("width")&&t.attr("height")&&(t.data({width:t.attr("width"),height:t.attr("height")}).on("display.uk.check",function(){n(t)}),n(t),i.push(t))}}),t.$win.on("resize load",t.Utils.debounce(function(){i.forEach(function(t){n(t)})},15))}(),t.Utils.stackMargin=function(i,n){n=t.$.extend({cls:"uk-margin-small-top"},n),n.cls=n.cls,i=t.$(i).removeClass(n.cls);var s=!1,e=i.filter(":visible:first"),a=e.length?e.position().top+e.outerHeight()-1:!1;a!==!1&&1!=i.length&&i.each(function(){var i=t.$(this);i.is(":visible")&&(s?i.addClass(n.cls):i.position().top>=a&&(s=i.addClass(n.cls)))})},t.Utils.matchHeights=function(i,n){i=t.$(i).css("min-height",""),n=t.$.extend({row:!0},n);var s=function(i){if(!(i.length<2)){var n=0;i.each(function(){n=Math.max(n,t.$(this).outerHeight())}).each(function(){var i=t.$(this),s=n-("border-box"==i.css("box-sizing")?0:i.outerHeight()-i.height());i.css("min-height",s+"px")})}};n.row?(i.first().width(),setTimeout(function(){var n=!1,e=[];i.each(function(){var i=t.$(this),a=i.offset().top;a!=n&&e.length&&(s(t.$(e)),e=[],a=i.offset().top),e.push(i),n=a}),e.length&&s(t.$(e))},0)):s(i)},function(i){t.Utils.inlineSvg=function(n,s){t.$(n||'img[src$=".svg"]',s||document).each(function(){var n=t.$(this),s=n.attr("src");if(!i[s]){var e=t.$.Deferred();t.$.get(s,{nc:Math.random()},function(i){e.resolve(t.$(i).find("svg"))}),i[s]=e.promise()}i[s].then(function(i){var s=t.$(i).clone();n.attr("id")&&s.attr("id",n.attr("id")),n.attr("class")&&s.attr("class",n.attr("class")),n.attr("style")&&s.attr("style",n.attr("style")),n.attr("width")&&(s.attr("width",n.attr("width")),n.attr("height")||s.removeAttr("height")),n.attr("height")&&(s.attr("height",n.attr("height")),n.attr("width")||s.removeAttr("width")),n.replaceWith(s)})})},t.ready(function(i){t.Utils.inlineSvg("[data-uk-svg]",i)})}({})}(UIkit); |