From b2f3412cadf5d7c4d82736f9c0e2525652efac3f Mon Sep 17 00:00:00 2001 From: Kurtas Date: Wed, 6 Aug 2014 13:48:04 +0200 Subject: [PATCH] Fix for Issue 101 - much better perfomance This is fix for issue described here https://github.com/mkoryak/floatThead/issues/101 Performance is much better. See this video for an explanation http://www.paulirish.com/2011/dom-html5-css3-performance/ I'm not javascript expert, but you can also try another tips from this video how to avoid "reflows" --- dist/jquery.floatThead.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/dist/jquery.floatThead.js b/dist/jquery.floatThead.js index 4db2d53..56d4b23 100644 --- a/dist/jquery.floatThead.js +++ b/dist/jquery.floatThead.js @@ -416,11 +416,14 @@ } } unfloat(); + var width = new Array(); for(i=0; i < numCols; i++){ - var _rowcell = $rowCells.get(i); - var rowWidth = _rowcell.offsetWidth; - $headerCells.eq(i).width(rowWidth); - $tableCells.eq(i).width(rowWidth); + var _rowcell = $rowCells.get(i); + width[i] = _rowcell.offsetWidth; + } + for(i=0; i < numCols; i++){ + $headerCells.eq(i).width(width[i]); + $tableCells.eq(i).width(width[i]); } refloat(); } else {