www.webdeveloper.com
Results 1 to 15 of 16

Thread: Font resizer help

Threaded View

  1. #1
    Join Date
    Oct 2006
    Posts
    203

    Font resizer help

    I am having issues with this:

    Code:
    $(document).ready(function(){
      var section = new Array('copy-content');
      section = section.join(',');
     
      // Reset Font Size
      var originalFontSize = $(section).css('font-size');
      $(".resetFont").click(function(){
        $(section).css('font-size', originalFontSize);
    	return false;
      });
     
      // Increase Font Size
      $(".increaseFont").click(function(){
        var currentFontSize = $(section).css('font-size');
        var currentFontSizeNum = parseFloat(currentFontSize, 10);
        var newFontSize = currentFontSizeNum*1.2;
        if (newFontSize < 16) {
    	$(section).css('font-size', newFontSize);
    	}
        return false;
      });
     
      // Increase Font Size
      $(".increaseFont-more").click(function(){
        var currentFontSize = $(section).css('font-size');
        var currentFontSizeNum = parseFloat(currentFontSize, 10);
        var newFontSize = currentFontSizeNum*1.35;
        if (newFontSize < 18) {
    	$(section).css('font-size', newFontSize);
    	}
        return false;
      });
      
    });
    HTML

    Code:
    <li><a href="#" class="normal resetFont">A</a> | <a href="#" class="zoom-in increaseFont">A</a> | <a href="#" class="zoom-more increaseFont-more">A</a></li>
    It works.....but when you click on increaseFont (good) and click after increaseFont-more, it wont function

    ...resetFont works (resets back to normal) ...
    ....but cannot go bigger with increaseFont-more and vice-versa if Im in increaseFont already.....only resetFont will work....what am I missing?

    Thanks
    Last edited by riskmod; 07-06-2012 at 02:26 PM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles