summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOliver Sartun <osartun@gmail.com>2015-12-01 22:52:28 +0100
committerOliver Sartun <osartun@gmail.com>2015-12-01 22:52:28 +0100
commitb924916def2b5b54f0323deb25b83d7232481aa3 (patch)
tree0ae0bbbbadbd5079e58623b829f667e199e8b90c
parentda22373ac257c6f569d9d91e60de54cae170d694 (diff)
downloadjQuery.equalHeights-b924916def2b5b54f0323deb25b83d7232481aa3.zip
jQuery.equalHeights-b924916def2b5b54f0323deb25b83d7232481aa3.tar.gz
jQuery.equalHeights-b924916def2b5b54f0323deb25b83d7232481aa3.tar.bz2
Improving minifaction process
-rw-r--r--jquery.equalheights.js9
-rw-r--r--jquery.equalheights.min.js2
2 files changed, 6 insertions, 5 deletions
diff --git a/jquery.equalheights.js b/jquery.equalheights.js
index a7e920a..5412377 100644
--- a/jquery.equalheights.js
+++ b/jquery.equalheights.js
@@ -19,6 +19,7 @@
});
return maxHeight;
},
+ height = 'height',
docEl = document.documentElement;
$(window).on('resize', function () {
@@ -30,7 +31,7 @@
// Don't waste time on elements that aren't in the DOM
if (elems.length && $.contains(docEl, elems[0]) ) {
_w.push(elems);
- elems.css('height', 'auto');
+ elems.css(height, 'auto');
}
}
@@ -38,7 +39,7 @@
for (i = 0, l = _w.length; i < l; i++) { m[i] = calcMaxHeight(_w[i]); }
// Set max height
- for (i = 0; i < l; i++) { _w[i].css('height', m[i]); }
+ for (i = 0; i < l; i++) { _w[i].css(height, m[i]); }
});
$.fn.equalHeights = function(options) {
@@ -71,13 +72,13 @@
loop = setInterval(function() {
if(maxHeight > 0) {
clearInterval(loop);
- return $this.css('height', maxHeight);
+ return $this.css(height, maxHeight);
}
maxHeight = calcMaxHeight($this);
}, 100);
return this;
} else {
- return $this.css('height', maxHeight);
+ return $this.css(height, maxHeight);
}
};
diff --git a/jquery.equalheights.min.js b/jquery.equalheights.min.js
index 128e039..723a407 100644
--- a/jquery.equalheights.min.js
+++ b/jquery.equalheights.min.js
@@ -8,4 +8,4 @@
*
* @version 1.5.2
*/
-!function(a){var b=[],c=function(b){var c,d=0;return b.each(function(){c=a(this).innerHeight(),c>d&&(d=c)}),d},d=document.documentElement;a(window).on("resize",function(){for(var e,f=0,g=b.length,h=[],i=[];g>f;f++)e=b[f],e.length&&a.contains(d,e[0])&&(h.push(e),e.css("height","auto"));for(f=0,g=h.length;g>f;f++)i[f]=c(h[f]);for(f=0;g>f;f++)h[f].css("height",i[f])}),a.fn.equalHeights=function(d){var e,f,g,h,i,j,k=a(this);if(d=d||{},e=c(k),d.watch){for(f=0,g=b.length,h;g>f;f++)if(k.is(b[f])){h=!0;break}h||b.push(k)}if(d.unwatch){for(f=0,g=b.length,i=[];g>f;f++)k.is(b[f])||i.push(b[f]);return b=i,this}return d.wait?(j=setInterval(function(){return e>0?(clearInterval(j),k.css("height",e)):void(e=c(k))},100),this):k.css("height",e)},a(document).on("ready",function(){a("[data-equal]").each(function(){var b=a(this),c=b.data(),d=c.equal;b.find(d).equalHeights(c)})})}(jQuery); \ No newline at end of file
+!function(a){var b=[],c=function(b){var c,d=0;return b.each(function(){c=a(this).innerHeight(),c>d&&(d=c)}),d},d="height",e=document.documentElement;a(window).on("resize",function(){for(var f,g=0,h=b.length,i=[],j=[];h>g;g++)f=b[g],f.length&&a.contains(e,f[0])&&(i.push(f),f.css(d,"auto"));for(g=0,h=i.length;h>g;g++)j[g]=c(i[g]);for(g=0;h>g;g++)i[g].css(d,j[g])}),a.fn.equalHeights=function(e){var f,g,h,i,j,k,l=a(this);if(e=e||{},f=c(l),e.watch){for(g=0,h=b.length,i;h>g;g++)if(l.is(b[g])){i=!0;break}i||b.push(l)}if(e.unwatch){for(g=0,h=b.length,j=[];h>g;g++)l.is(b[g])||j.push(b[g]);return b=j,this}return e.wait?(k=setInterval(function(){return f>0?(clearInterval(k),l.css(d,f)):void(f=c(l))},100),this):l.css(d,f)},a(document).on("ready",function(){a("[data-equal]").each(function(){var b=a(this),c=b.data(),d=c.equal;b.find(d).equalHeights(c)})})}(jQuery); \ No newline at end of file