Created
June 12, 2013 15:45
-
-
Save bananabread/5766522 to your computer and use it in GitHub Desktop.
jQuery Text Sizer
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Reset Font Size | |
| var originalFontSize = $('html').css('font-size'); | |
| $(".resetFont").click(function() { | |
| $('html').css('font-size', originalFontSize); | |
| }); | |
| // Increase Font Size | |
| $(".increaseFont").click(function() { | |
| var currentFontSize = $('html').css('font-size'); | |
| var currentFontSizeNum = parseFloat(currentFontSize, 10); | |
| var newFontSize = currentFontSizeNum * 1.2; | |
| $('html').css('font-size', newFontSize); | |
| return false; | |
| }); | |
| // Decrease Font Size | |
| $(".decreaseFont").click(function() { | |
| var currentFontSize = $('html').css('font-size'); | |
| var currentFontSizeNum = parseFloat(currentFontSize, 10); | |
| var newFontSize = currentFontSizeNum * 0.8; | |
| $('html').css('font-size', newFontSize); | |
| return false; | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment