• How do I give the reader three button to change the font size? I dont want CTRL + MouseWheel because it stretches everything.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Place this Javascript somewhere in the <head> </head> section of your header.php file:

    <script language="JavaScript" type="text/javascript">
    function changeFontSize(inc)
    {
      var p = document.getElementsByTagName('p');
      for(n=0; n<p.length; n++) {
        if(p[n].style.fontSize) {
           var size = parseInt(p[n].style.fontSize.replace("px", ""));
        } else {
           var size = 12;
        }
        p[n].style.fontSize = size+inc + 'px';
       }
    }
    </script>

    Then, where ever you want to place the controls add:

    <a href="javascript:changeFontSize(1)">Increase Font Size</a>
    <a href="javascript:changeFontSize(-1)">Decrease Font Size</a>

    You can link these too images as well.

    Hope that helps.

    Thread Starter fr0s3in

    (@fr0s3in)

    thx so much! worked like a charm!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Change Font Size’ is closed to new replies.