jQuery Text Resizing Plugin FancyTextFill - Download Responsive Performant jQuery Text Resizing Plugin - FancyTextFill

Download Responsive Performant jQuery Text Resizing Plugin – FancyTextFill

Posted on

This time I will share jQuery Plugin and tutorial about Responsive Performant jQuery Text Resizing Plugin – FancyTextFill, hope it will help you in programming stack.

jQuery Text Resizing Plugin FancyTextFill - Download Responsive Performant jQuery Text Resizing Plugin - FancyTextFill
File Size: 12.3 KB
Views Total: 1401
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
   

FancyTextFill is a responsive and high-performance jQuery text resizing plugin inspired by textfill and& Bigtext that automatically increases and shrinks the font size of your text to fit its container.

Installation:

1 # Yarn
2 $ yarn add fancy-textfill
3  
4 # NPM
5 $ npm install fancy-textfill --save

How to use it:

1. Load the latest version of jQuery and the jQuery FancyTextFill plugin’s script fancy-text-fill.jQuery.js in the document.

1 <script src="/path/to/cdn/jquery.slim.min.js"></script>
2 <script src="/path/to/fancy-text-fill.jQuery.js"></script>

2. Wrap your text into a container with a fixed height.

1 <div class="box">
2   <span class="myText">
3     Suspendisse egestas at mi ultrices interdum. Vivamus auctor tincidunt tortor eu faucibus.
4   </span>
5 </div>
1 .box {
2   width: 100%;
3   height: 50px;
4 }
5  
6 .myText { display: block; }

3. Initialize the plugin and set the maximum/minimum font-size of the text.

1 $('.myText').fancyTextFill({
2   minFontSize: 12,
3   maxFontSize: 64
4 });

4. Re-initialize the plugin on window resize.

1 $(window).on('resize', function(){
2   $('.myText').fancyTextFill({
3     minFontSize: 12,
4     maxFontSize: 64
5   });
6 });

5. More configuration options.

01 $('.myText').fancyTextFill({
02  
03   // max width/height to resize
04   maxWidth: null,
05   maxHeight: null,
06  
07   // supports multiline text
08   multiline: true,
09  
10   // When set to false, line-heights are assumed to be relative to the current font-size
11   explicitLineHeight: false
12    
13 });

Changelog:

v1.2.5 (2018-08-20)

  • Prevent invisible element from occupying any space

This awesome jQuery plugin is developed by fazouane-marouane. For more Advanced Usages, please check the demo page or visit the official website.

source : jquery.net