View on GitHub

Scalable Text

A light-weight responsive text jQuery plugin to make your text liquid.

Download this project as a .zip file Download this project as a tar.gz file

Scalable Text

A light-weight responsive text jQuery plugin inspired by FlowType. Use it to "liquify" text on your website so that it scales relative to the width of the parent element or, optionally, any element you specify (see Options below).

NOTE: This project has been replaced with Scalem JS, a better, more reliable and flexible jQuery plugin. This repository is outdated and is kept only as a matter of record.

Options

Property Description
reference Selector to the reference element (text will scale relative to this element's width). If this option is not provided, then the default reference element will be the parent element.
styles Array of additional styles to scale in addition to font-size.

Usage

<body>
<h1>Scalable Heading</h1>
<div>
  <strong>Scalable Text</strong>
</div>
<p>
  <button>Scalable Button</button>
</p>
...
<script>
$(document).ready(function() {
  // Default options
  $('h1').scaleText();
  // Scale relative to <h1> instead of <div>
  $('strong').scaleText({
    reference: 'h1'
  });
  // You can scale an entire button by doing this:
  $('button').scaleText({
    styles: ['padding-top', 'padding-right', 'padding-bottom', 'padding-left']
  });
}
</script>
</body>

See a demo »