diff --git a/README.md b/README.md index 03f886d..66a4166 100644 --- a/README.md +++ b/README.md @@ -24,6 +24,9 @@ This advanced usage is for dynamic instances where equalize is ran after element Equalize the .parent's child element. See @larsbo's example.
$('.parent').equalize({children: 'p'}); // equalize height of paragraphs within .parent
+By setting clear to true the height/width will be removed. +
$('.parent').equalize({clear: true}); // default to clear height
+$('.parent').equalize({equalize: 'width', clear: true}); // clear width
## Examples diff --git a/css/style.css b/css/style.css index 04b5226..11ee30c 100644 --- a/css/style.css +++ b/css/style.css @@ -76,7 +76,7 @@ td { vertical-align: top; } /* ========================================================================= - Primary Styles + Primary Styles ========================================================================== */ body { color: #333; padding-bottom: 3em; } @@ -138,6 +138,7 @@ pre { } #advanced-example div, +#clear-example div, #height-example div { width: 60px; } /* #width-example div { } */ @@ -174,7 +175,7 @@ pre { /* ============================================================================= Print Styles ========================================================================== * / - + @media print { * { background: transparent !important; color: black !important; box-shadow:none !important; text-shadow: none !important; filter:none !important; -ms-filter: none !important; } /* Black prints faster: h5bp.com/s * / a, a:visited { text-decoration: underline; } diff --git a/index.html b/index.html index 37497b0..172dfbf 100644 --- a/index.html +++ b/index.html @@ -46,6 +46,10 @@

Advanced Usage

Equalize the .parent's child element. See @larsbo's example.

$('.parent').equalize({children: 'p'}); // equalize height of paragraphs within .parent
+

By setting clear to true the height/width will be removed.

+
$('.parent').equalize({clear: true}); // default to clear height
+$('.parent').equalize({equalize: 'width', clear: true}); // clear width
+

Height Example run »

$('#height-example').equalize(); // defaults to height
@@ -75,7 +79,7 @@

Width Example run »

Advanced Example run »

-
$('#height-example').equalize({reset: true});
+
$('#advanced-example').equalize({reset: true});

Below the tallest div has a height of 200px, this will be removed before determining the max height, otherwise all elements would have a height of 200px.

@@ -90,6 +94,23 @@

Advanced Example run »equalize content height

equalize
+ +

Clear Example run »

+
$('#clear-example').equalize({reset: true});
+

Below the tallest div has a height of 200px, this will be cleared.

+ +
+
equalize
+
equalize content height
+
equalize
+
equalize
+
equalize
+
equalize content
+
equalize
+
equalize
+
equalize content height
+
equalize
+
@@ -105,6 +126,8 @@

Advanced Example run » max) { max = value; } // update max }); - $children.css(type, max +'px'); // add CSS to children + if (destroy) { + $children.css(type, ''); // remove CSS from children + } else { + $children.css(type, max +'px'); // add CSS to children + } // destroy function }); }; diff --git a/js/equalize.min.js b/js/equalize.min.js index afdbd18..a9688dc 100644 --- a/js/equalize.min.js +++ b/js/equalize.min.js @@ -6,4 +6,4 @@ * Page: http://tsvensen.github.com/equalize.js * Repo: https://github.com/tsvensen/equalize.js/ */ -!function(i){i.fn.equalize=function(e){var n,t,h=!1,c=!1;return i.isPlainObject(e)?(n=e.equalize||"height",h=e.children||!1,c=e.reset||!1):n=e||"height",i.isFunction(i.fn[n])?(t=0s&&(s=e)}),e.css(t,s+"px")})):!1}}(jQuery); \ No newline at end of file +!function(a){a.fn.equalize=function(b){var g,h,c=this,d=!1,e=!1,f=!1;return a.isPlainObject(b)?(g=b.equalize||"height",d=b.children||!1,e=b.reset||!1,f=b.clear||!1):g=b||"height",!!a.isFunction(a.fn[g])&&(h=g.indexOf("eight")>0?"height":"width",c.each(function(){var b=d?a(this).find(d):a(this).children(),c=0;b.each(function(){var d,b=a(this);(e||destroy)&&b.css(h,""),d=b[g](),d>c&&(c=d)}),destroy?b.css(h,""):b.css(h,c+"px")}))}}(jQuery); \ No newline at end of file