-
Notifications
You must be signed in to change notification settings - Fork 0
/
equalDiv.min.js
3 lines (3 loc) · 1.25 KB
/
equalDiv.min.js
1
2
3
window.equalDiv=function(){function m(q){e="";c.textContent="";for(b=0;b<h.length;b++){a=h[b];if(q>a.f){a.c=[];for(f=0;f<a.items.length;f++)k=a.items[f].clientHeight,a.c.push(k>a.minHeight?k:a.minHeight);a.b=Math.max.apply(null,a.c);a.a=!0}else 0<a.b&&(a.a=!0),a.b="";a.a&&(e+="."+a.g+b+"{height:"+a.b+"px;}",a.a=!1)}c.textContent=e}var b=0,f=0,c,e="",k=0,a,h;return{init:function(b){function f(a){switch(a){case "small":return d[0]||0;case "medium":return d[1]||640;case "large":return d[2]||1024;case "xlarge":return d[3]||
1280;case "xxlarge":return d[4]||1440}}var g=b||{},l=g.watch||"equalizer",n=g.o||"equalizerCSS";b=g.i||window.innerWidth;var p=document.body.querySelectorAll("[data-"+l+"]"),d=g.h||[0,640,1024,1280,1440];p?(h=function(a){function b(a,b){this.g=b;for(var c=0,e=a.querySelectorAll("[data-"+l+"-watch]");c<e.length;c++)e[c].classList.add(b+d);this.items=e;this.f=f(a.getAttribute("data-equalize-on"))||f(g.f||"medium");this.c=[];this.minHeight=a.getAttribute("data-"+l+"-minheight")||0;this.a=!1;this.b=0}
var d=0,e=[];c=document.getElementById(n);c||(c=document.createElement("style"),c.id=n,document.head.appendChild(c));for(;d<a.length;d++)e.push(new b(a[d],a[d].getAttribute("data-"+l)||"equ"));return e}(p),d.map(f),m(b)):h=a=k=e=c=null},equalize:m}}();