Skip to content

Commit

Permalink
normalizado var para let, removido ponto e vírgula, aspas simples par…
Browse files Browse the repository at this point in the history
…a duplas
  • Loading branch information
luislobo9b committed Nov 30, 2024
1 parent 2ed9ba5 commit bb24fa0
Showing 1 changed file with 13 additions and 17 deletions.
30 changes: 13 additions & 17 deletions jquery.fittext.js
Original file line number Diff line number Diff line change
@@ -1,28 +1,24 @@
$.fn.fitText = function( kompressor, options ) {

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

return this.each(function(){
minFontSize : -Infinity,
maxFontSize : Infinity
}, options)

return this.each(function() {
// Store the object
var $this = $(this);
let $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)));
};
let 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();
resizer()

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

});

};
$(window).on("resize.fittext orientationchange.fittext", resizer)
})
}

0 comments on commit bb24fa0

Please sign in to comment.