From c6c941c884ac52ec92dd907e3037cda1ee78a464 Mon Sep 17 00:00:00 2001 From: Kevin Ghadyani Date: Sun, 4 May 2014 04:52:15 -0500 Subject: [PATCH] Added resizeModifier for selectively adding or removing specific fitText() calls Helps with responsive designs where at certain breakpoints the resize operation should no longer take place regardless of a minimum or maximum font-size. --- jquery.fittext.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/jquery.fittext.js b/jquery.fittext.js index 0b3ddef..5169eb5 100644 --- a/jquery.fittext.js +++ b/jquery.fittext.js @@ -17,7 +17,8 @@ var compressor = kompressor || 1, settings = $.extend({ 'minFontSize' : Number.NEGATIVE_INFINITY, - 'maxFontSize' : Number.POSITIVE_INFINITY + 'maxFontSize' : Number.POSITIVE_INFINITY, + 'resizeModifier' : '' }, options); return this.each(function(){ @@ -33,8 +34,12 @@ // Call once to set. resizer(); + if (settings.resizeModifier && settings.resizeModifier.length > 0) { + settings.resizeModifier = '.' + settings.resizeModifier + } + // Call on resize. Opera debounces their resize by default. - $(window).on('resize.fittext orientationchange.fittext', resizer); + $(window).on('resize.fittext' + settings.resizeModifier + ' orientationchange.fittext' + settings.resizeModifier, resizer); });