jQuery fontResize


/ Published in: jQuery
Save to your folder(s)



Copy this code and paste it in your HTML
  1. function fontResize() {
  2. //Set default resolution and font size
  3. var resolution = 1024;
  4. var font = 13;
  5.  
  6. //Get window width
  7. var width = $(window).width();
  8.  
  9. //Set new font size
  10. var newFont = font * (width/resolution);
  11. $('body').css('font-size', newFont);
  12. };
  13.  
  14. $(document).ready(function()
  15. {
  16. fontResize();
  17. $(window).bind('resize', function() {
  18. fontResize();
  19. });
  20. }
  21. );

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.