javascript - Equal height script almost works -


i'm using equalize heights of 2 columns:

function equalheight(one, two) {     if (document.getelementbyid(one)) {         var lh = document.getelementbyid(one).offsetheight;         var rh = document.getelementbyid(two).offsetheight;         var nh = math.max(lh, rh);         document.getelementbyid(one).style.height = nh + "px";         document.getelementbyid(two).style.height = nh + "px";     } } window.onload = function () {     equalheight('primary', 'secondary'); } 

... works great, except height of tallest column increased further 4-5px more, not required. why wouldn't calculate height of tallest column accurately?

thanks

because included padding. make sure remove that, either reading out value of , subtracting it, or manually doing using

var nh = math.max(lh, rh) - 4; 

or 5 or whatever needed!


Comments

Popular posts from this blog

php - What is the difference between $_SERVER['PATH_INFO'] and $_SERVER['ORIG_PATH_INFO']? -

fortran - Function return type mismatch -

queue - mq_receive: message too long -