Posted By

silentpro on 07/30/11


Tagged

javascript js resize textmate script jquery font increase decrease


Versions (?)

Font Resizing


 / Published in: Other
 

  1. /* Font Resizing
  2. http://www.shopdev.co.uk/blog/text-resizing-with-jquery/
  3. */
  4.  
  5. $(document).ready(function(){
  6. // Reset Font Size
  7. var originalFontSize = $('html').css('font-size');
  8. $(".resetFont").click(function(){
  9. $('html').css('font-size', originalFontSize);
  10. });
  11. // Increase Font Size
  12. $(".increaseFont").click(function(){
  13. var currentFontSize = $('html').css('font-size');
  14. var currentFontSizeNum = parseFloat(currentFontSize, 10);
  15. var newFontSize = currentFontSizeNum*1.2;
  16. $('html').css('font-size', newFontSize);
  17. return false;
  18. });
  19. // Decrease Font Size
  20. $(".decreaseFont").click(function(){
  21. var currentFontSize = $('html').css('font-size');
  22. var currentFontSizeNum = parseFloat(currentFontSize, 10);
  23. var newFontSize = currentFontSizeNum*0.8;
  24. $('html').css('font-size', newFontSize);
  25. return false;
  26. });
  27. });

Report this snippet  

You need to login to post a comment.