I have a page containing a random number of rows, each row has 2 columns. The challenge is to make these two columns the same height for each row. I am doing this with JS.
var len = document.getElementById("translateContainer").children.length; for(var i = 0; i<len; i++) { var height = document.getElementById("origin_"+i).offsetHeight + 'px', col1 = document.getElementById("column_"+i), col2 = document.getElementById("column_sec_"+i); console.log(i); col1.style.height = height; col2.style.height = height; }
If the page has less than 30-40 lines, all this is good. But, when there are more than 200 lines, chrome starts to lag a couple of seconds.
I created a demo page here http://jsfiddle.net/YSp76/ .
In FF and IE, it runs after about 2 seconds. In chrome, I did not count, but more than 10.
Is there a problem in my code or a webkit error?
javascript google-chrome
Ivan G
source share