Super Simple jQuery Responsive Text Resize Plugin - textStretch.js

File Size: 4.6KB
Views Total: 1370
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
   
Super Simple jQuery Responsive Text Resize Plugin - textStretch.js

Just another jQuery text resize plugin for responsive website, textStretch.js allows to dynamically resize the text as big as possible to fit the width of its parent container when the browser window resized.

You might also like:

How to use it:

1. Create some text within the <p> tag.

<p class="demo">YOUR TEXT</p>

2. Include the jQuery javascript library and textStretch.js script on the web page.

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script> 
<script src="jquery.textStretch.js"></script> 

3. Call the plugin with default options.

<script>
$(window).load(function () {
$(".demo").textStretch();
});
</script>

4. Available options.

<script>
$(window).load(function () {
$(".demo").textStretch({
width: null, // specified witdh
minFontSize: '12', // set the minimum font size of the resized text
maxFontSize: Number.POSITIVE_INFINITY, // // set the maximum font size of the resized text
refresh: false
});
});
</script>

Change log

2013-12-10

  • added fixed big font-size for measuring class (more reliable)

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