Skip to content

Commit

Permalink
Merge pull request davatron5000#31 from darcyclarke/master
Browse files Browse the repository at this point in the history
Made some micro optimizations
  • Loading branch information
davatron5000 committed Jun 14, 2012
2 parents 96677fd + 832fe8d commit fa3b29a
Showing 1 changed file with 11 additions and 12 deletions.
23 changes: 11 additions & 12 deletions jquery.fittext.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,18 @@
(function( $ ){

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

var settings = {
'minFontSize' : Number.NEGATIVE_INFINITY,
'maxFontSize' : Number.POSITIVE_INFINITY
};

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

return this.each(function(){
var $this = $(this); // store the object
var compressor = kompressor || 1; // set the compressor

if ( options ) {
$.extend( settings, options );
}

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

// Resizer() resizes items based on the object width divided by the compressor * 10
var resizer = function () {
Expand All @@ -35,7 +34,7 @@
resizer();

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

});

Expand Down

0 comments on commit fa3b29a

Please sign in to comment.