Submit your widget

Responsive text jQuery plugin to make your text liquid

Created 5 years ago   Views 9640   downloads 1611    Author thdoan
Responsive text jQuery plugin to make your text liquid
View DemoDownload
53
Share |

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).

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: ['border-radius', 'padding-top', 'padding-right', 'padding-bottom', 'padding-left']
  });
}
</script>
</body>