scrollfit

Tiny vanilla js module that fits text inside an HTML Element according to its scrollWidth/scrollHeight compared to its clientWidth/clientHeight

Usage no npm install needed!

<script type="module">
  import scrollfit from 'https://cdn.skypack.dev/scrollfit';
</script>

README

scrollfit.js

Tiny vanilla js module that fits text inside an HTML Element according to its scrollWidth/scrollHeight compared to its clientWidth/clientHeight.

Installation

npm install scrollfit --save

Usage

Scrollfit = require('scrollfit')

new Scrollfit(document.querySelector('.scrollfit'))

// or use integrated hook lookup:
<div data-hook="scrollfit"> Some text that shoud be fitted</div>

Contributing

Yes, please. See github issues to get started. Needs more documentation and stuff. (As always)

Thanks

Highly inspired by the following awesome projects:

An opensource module brought to you with love from optune.me