PHP Classes

File: app/Resources/public/js/vendor/jquery.fittext.js

Recommend this page to a friend!
  Classes of Manolo Salsas  >  Online PHP Image Transform  >  app/Resources/public/js/vendor/jquery.fittext.js  >  Download  
File: app/Resources/public/js/vendor/jquery.fittext.js
Role: Auxiliary data
Content type: text/plain
Description: Auxiliary data
Class: Online PHP Image Transform
Application to do interactive image manipulation
Author: By
Last change:
Date: 2 years ago
Size: 1,074 bytes
 

Contents

Class file image Download
/*global jQuery */
/*!
* FitText.js 1.1
*
* Copyright 2011, Dave Rupert http://daverupert.com
* Released under the WTFPL license
* http://sam.zoy.org/wtfpl/
*
* Date: Thu May 05 14:23:00 2011 -0600
*/

(function( $ ){

  $.fn.fitText = function( kompressor, options ) {

    // Setup options
    var compressor = kompressor || 1,
        settings = $.extend({
          'minFontSize' : Number.NEGATIVE_INFINITY,
          'maxFontSize' : Number.POSITIVE_INFINITY
        }, options);

    return this.each(function(){

      // Store the object
      var $this = $(this);

      // Resizer() resizes items based on the object width divided by the compressor * 10
      var resizer = function () {
        $this.css('font-size', Math.max(Math.min($this.width() / (compressor*10), parseFloat(settings.maxFontSize)), parseFloat(settings.minFontSize)));
      };

      // Call once to set.
      resizer();

      // Call on resize. Opera debounces their resize by default.
      $(window).on('resize.fittext orientationchange.fittext', resizer);

    });

  };

})( jQuery );
For more information send a message to info at phpclasses dot org.