From 70b0a1eb10dfc1cfc1c52d82aaaf5408d5ec9efa Mon Sep 17 00:00:00 2001 From: Corey Maass Date: Sun, 15 May 2016 16:27:57 -0500 Subject: [PATCH] Adding a minimum height option I have a bunch of elements I want to match in height, but I always want them to be at least a certain height. Now I can pass a min-height and ensure they'll be at least that tall. --- dist/jquery.matchHeight.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/dist/jquery.matchHeight.js b/dist/jquery.matchHeight.js index 38544af..e98e62f 100644 --- a/dist/jquery.matchHeight.js +++ b/dist/jquery.matchHeight.js @@ -82,7 +82,8 @@ byRow: true, property: 'height', target: null, - remove: false + remove: false, + minHeight: 0 }; if (typeof options === 'object') { @@ -278,6 +279,12 @@ verticalPadding += _parse($that.css('padding-top')) + _parse($that.css('padding-bottom')); } + // set height to minimum height, if less than element + if ( targetHeight < opts.minHeight ) + { + targetHeight = opts.minHeight; + } + // set the height (accounting for padding and border) $that.css(opts.property, (targetHeight - verticalPadding) + 'px'); });