From 6f08f2ad7eedc7a5c61303fae0d78533039a48c1 Mon Sep 17 00:00:00 2001 From: Jason Yarrington Date: Thu, 9 Oct 2014 11:46:40 -0400 Subject: [PATCH] Added centering of the text vertically --- flowtype.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/flowtype.js b/flowtype.js index 5ed5162..bdcada8 100644 --- a/flowtype.js +++ b/flowtype.js @@ -32,6 +32,13 @@ fontBase = width / settings.fontRatio, fontSize = fontBase > settings.maxFont ? settings.maxFont : fontBase < settings.minFont ? settings.minFont : fontBase; $el.css('font-size', fontSize + 'px'); + + // Center vertically in the parent Div + var myHeight = $el.height(), + myParentHeight = $el.parent().height(), + myPaddingTop = (myParentHeight - myHeight) / 2; + + $el.css('padding-top', myPaddingTop + 'px'); }; // Make the magic visible @@ -45,4 +52,4 @@ changes(this); }); }; -}(jQuery)); \ No newline at end of file +}(jQuery));