jQuery – Dynamically change the font size of your website on run-time!

You might have seen some website have an option to increase and decrease the font size of the website by clicking an icon or link.

Same option you can have in your website too with the help of this simple jQuery Font resize Script!.

You can see the demo at the bottom of the page

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
var fontSize;

fontSize = parseInt($("p").css('font-size'));
fontSize = fontSize + 1 + "px";
fontSize = parseInt($("p").css('font-size'));
fontSize = fontSize - 1 + "px";
$("p").css({'font-size' : fontSize});

Lorem Ipsum is simply dummy text of the printing and typesetting industry.
Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.
It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged.
It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages,
and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
<a href="#" id="insize">Increase Font Size</a>
<a href="#" id="desize">Decrease Font Size</a>

You can also see the demo here or just download and use it!


One Comment

Add a Comment

Your email address will not be published. Required fields are marked *