From 68e8cf4475c84b8fb5a0a724dd5dc544506cb03f Mon Sep 17 00:00:00 2001 From: Peter Date: Mon, 17 Sep 2018 08:16:32 +0200 Subject: [PATCH] Add minFontSize & maxFontSize --- README.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/README.md b/README.md index 121c9f2..6af75f5 100644 --- a/README.md +++ b/README.md @@ -25,6 +25,15 @@ fitText( document.getElementById("responsive_headline"), 0.8 ); // turn the comp ``` This will hopefully give you a level of "control" that might not be pixel perfect, but scales smoothly & nicely. +## minFontSize & maxFontSize +FitText now allows you to specify two optional pixel values: `minFontSize` and `maxFontSize`. Great for situations when you want to preserve hierarchy. + +```javascript +fitText( document.getElementById("responsive_headline"), 1, { minFontSize: '20px', maxFontSize: '40px' }); +``` + +These options are passed to the `fitText` function right after the compressor value (here `1`). + ### To Do With the removal of jQuery, element resize events are no longer available. jQuery uses an inefficient polling method to detect element resizing so a better solution is needed anyway. One potential candidate: https://github.com/marcj/css-element-queries