Created
October 20, 2014 18:33
-
-
Save reubeningber/167cce302d2d14600a49 to your computer and use it in GitHub Desktop.
FitText Helper
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // FitText | |
| // Add class js-fit-text & Set the following data-attributes: data-fit-compressor="<compressor value>" data-fit-max-font-size=<size>px" data-fit-min-font-size="<size>px" | |
| $('.js-fit-text').each(function() { | |
| var $this = $(this), | |
| fitCompressor = $this.data('fit-compressor') || 1, | |
| fitMaxFontSize = $this.data('fit-max-font-size') || Number.POSITIVE_INFINITY, | |
| fitMinFontSize = $this.data('fit-min-font-size') || Number.NEGATIVE_INFINITY; | |
| $this.fitText(fitCompressor, {maxFontSize: fitMaxFontSize, minFontSize: fitMinFontSize}); | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment