Smart jQuery Responsive Text Plugin - TextTailor.js
File Size: | 16.4 KB |
---|---|
Views Total: | 2964 |
Last Update: | |
Publish Date: | |
Official Website: | Go to website |
License: | MIT |
TextTailor.js is a jQuery plugin designed for responsive web layout that automatically resizes font size to make your text fit within its parent container.
The plugin also has the ability to hide the overflowed text using ellipsis in case your text doesn't fit the height (fixed or percentage) of the parent container.
Basic Usage:
1. Load the latest version of jQuery library from a CDN and the jQuery texttailor.js at the bottom of your responsive webpage.
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <script src="jquery.texttailor.js"></script>
2. Wrap your text into a container element.
<div class="demo"> Your text goes here </div>
3. Gives a height (fixed or percentage) to the container element in the CSS.
.demo { width: xx%; height: xx%; }
4. Call the plugin on the container to active the responsive text.
$('.demo').textTailor();
6. Options available.
$('.demo').textTailor({OPTIONS});
minFont: 1
: minimum font (use with fit: true)maxFont: 9999
: maximum font (use with fit: true)preWrapText: false
: adds css -> white-space: pre-linelineHeight: 1.45
: line-height propertyresizable: true
: tailor again on window resizedebounce: false
: use with resizable: truefit: true
: fit the text to the parent's height and widthellipsis: true
: ellipsis the text if it doesn't fitcenter: false
: absolute center relatively to the parentjustify: false
: adds css -> text-align: justify
Changelog:
2020-06-09
- v0.1.2
2019-01-29
- JS updated
This awesome jQuery plugin is developed by jpntex. For more Advanced Usages, please check the demo page or visit the official website.