Minimal Text Resizing JavaScript Library – fitty

Category: Javascript , Recommended , Text | October 7, 2018
Author: rikschennink
Views Total: 2,303
Official Page: Go to website
Last Update: October 7, 2018
License: MIT

Preview:

Minimal Text Resizing JavaScript Library – fitty

Description:

fitty is a small, zero-dependency JavaScript library that dynamically scales the text to fill its parent container.

Installation:

# NPM
$ npm install fitty --save

Basic usage:

To get started, just include the fitty’s JavaScript at the bottom of the webpage:

<script src="fitty.min.js"></script>

Then initialize the fitty on the target text container. That’s it.

fitty('.fit');

If you want to set the min and max font-size values:

fitty('.fit',{
  minSize: 16,
  maxSize: 256
});

Decide whether to apply the fitty to multi-line text.

fitty('.fit',{
  multiLine: true
});

Decide whether to rescale the text when the content is altered.

fitty('.fit',{
  observeMutations: true
});

Changelog:

v2.2.6 (10/07/2018)

  • add comments, move prestyle logic upward and add make conditional

You Might Be Interested In:


Leave a Reply