davatron5000 / FitText.js

A jQuery plugin for inflating web type
http://fittextjs.com
6.75k stars 1.39k forks source link

Using Math.min makes fontResize var needless #1

Closed Boldewyn closed 13 years ago

Boldewyn commented 13 years ago

The comparison with the ternary operator is unnecessary, if you use the built-in Math.min function. Then you can even completely skip var fontResize.

The resizer function also doesn't need the "obj" variable, since it always points to $this.

davatron5000 commented 13 years ago

whoah awesome. thank you. i just tested it on the example.html and it looks like you'll need to change line 18 to:

var origFontSize = parseInt($this.css('font-size'));   // init the font size

I was getting NaN for the font-size. patch that guy and i'll make it live!

Boldewyn commented 13 years ago

Done. I used parseFloat, since it might be something like 14.5px as well.