Skip to content

stephenjwatkins/jquery-fontstretch

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 

Repository files navigation

FontStretch - jQuery Plugin

FontStretch adjusts the size of text to fit within its containing element.

Usage

HTML:

<!DOCTYPE html>
<html>
    <head>
        <title>FontStretch</title>
    </head>
    <body>
        <div class="tagline">The quick brown fox...</div>
        <script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js"></script>
        <script type="text/javascript" src="jquery.fontstretch.js"></script>
    </body>
</html>

JS:

$('.tagline').fontStretch();

Options

Option Default Description
width null Optional. Fit the text element within the specified size in pixels. Otherwise, grab the width of the element.
sizeLimit 999 Optional. Limits the maximum font size to the specified value.
sizeOffset 1 Optional. Start calculating font sizes from the specified value.
sizeIncrement 1 Optional. Increment with the specified value while calculating the font size, useful for bigger fonts to reduce the number of loops.

About

jQuery plugin to dynamically stretch the font within a containing element.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published