Jump to content

How do I make my font size resizable using JQuerry or JavaScript?

- - - - -

  • Please log in to reply
1 reply to this topic

#1
Stasonix

Stasonix

    Learning Programmer

  • Members
  • PipPipPip
  • 82 posts
  • Programming Language:C++, PHP, JavaScript, Delphi/Object Pascal, Pascal
  • Learning:C++, PHP, JavaScript, Delphi/Object Pascal
Hi, I need to know is it possible to handle function on this events 'collapse' and 'expand', as I see in Events – jQuery API there is nothing about these events, how do I can call function to them? There is only resize, but it's not the same!

p.s. it's need for make my font-size resizable, maybe we have another solution?

#2
oldhendra

oldhendra

    Learning Programmer

  • Members
  • PipPipPip
  • 30 posts
How the existing .resize() differs to yours, precisely?

Something like below was developed from .resize():
$(document).ready(function() {
  var 
    oldWinH = $(window).height(),
    oldFontSize = $('#targetElementID').css('font-size').slice(0,-2);
  $(window).resize(function() {
    var 
      newWinH = $(window).height(),
      newFontSize = Math.round(newWinH / oldWinH * oldFontSize);
    $('#targetElementID').css('font-size', newFontSize);
  });
});





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users