jQuery.fn.evolutionSqueezeText
This plugin enables text of unknown length to be auto-scaled to fit within a container with a defined width. Text that is too long to fit within a single line in a container is manipulated using a series of test iterations to refine its letter spacing and font size until it fits, or until minimum size and spacing thresholds are met. If the text cannot be made to fit, it is truncated.
Usage
Initializes the selected container to squeeze its text:
$(container).evolutionSqueezeText(options)
Options
-
minSize
: Minimum font size to use before truncation, in pixels- default: 9
-
minSpacing
: : Minimum letter-spacing to use before truncation, in pixels- default: -0.5
-
enableSpacing
: When enabled, includes letter spacing adjustment attempts when squeezing- default: true
-
resetOnFailure
: When enabled, text that cannot be squeezed within a container is reset to its original font size and letter spacing- default: false
-
truncateOnFailure
: When enabled, text that cannot be squeezed within a container is truncated- default: true
-
onFailure
: Callback invoked when text cannot be squeezed within the container- default: null