Skip to content

Commit 3adec21

Browse files
committed
Improved performance .css 'jquery' x .style 'js'
1 parent c7acedd commit 3adec21

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

jquery.fittext.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,10 @@
2727

2828
// Resizer() resizes items based on the object width divided by the compressor * 10
2929
var resizer = function () {
30-
$this.css('font-size', Math.max(Math.min($this.width() / (compressor*10), parseFloat(settings.maxFontSize)), parseFloat(settings.minFontSize)));
30+
var valFontSize = Math.max(Math.min($this.width() / (compressor*10), parseFloat(settings.maxFontSize)), parseFloat(settings.minFontSize));
31+
32+
var cachedStyle = document.getElementById($this.attr('id')).style;
33+
cachedStyle.fontSize = valFontSize;
3134
};
3235

3336
// Call once to set.

0 commit comments

Comments
 (0)