autosizer
Version:
Automatically resize textarea to fit text when typing.
29 lines (18 loc) • 784 B
Markdown
Apply to any textarea on the page and let it automatically resize to fit
any text typed or pasted inside.
Demo: <http://kanecohen.github.io/autosizer/>
Autosizer can be inserted into page as an ordinary script, or it could be
loaded as an AMD or CommonJS module.
Autosizer also support usage as a jQuery plugin, but jQuery is **not required**.
````
var Autosizer = require('autosizer');
var as = new Autosizer('.my-textarea');
````
Besides an element, autosizer accepts an object with several possible options
`follow: true` When set to true, scrollbar will always try to stay in a constant
position related to where typing caret is located.
`viewportMargin: null` Limits maximum height before textarea hits bottom of the
viewport.