Rosetta Code:Language comparison script: Difference between revisions

Limiting the number of columns so they should each always contain at least three primary language items.
(Fixed width resizing bug for IE8)
(Limiting the number of columns so they should each always contain at least three primary language items.)
Line 70:
//figure out the ideal number of columns
tocEl.style.width = "100%";
var idealColumns = Math.min(Math.floor(GetElWidth(tocEl) / maxWidth), Math.floor(liEls.length / 3) + 1);
if(navigator.appVersion.indexOf("MSIE 5.") >= 0 || navigator.appVersion.indexOf("MSIE 6.") >= 0 || navigator.appVersion.indexOf("MSIE 7.") >= 0)
{
Line 262:
//and refresh the display for good measure (sometimes browsers like to save <input> states between reloads)
CompareRefresh();
//add an event listener for window resizing
if(window.addEventListener)
{
window.addEventListener("resize", CompareRefresh, false);
}
else if(document.addEventListener)
{
document.addEventListener("resize", CompareRefresh, false);
}
else if(window.attachEvent)
{
window.attachEvent("onresize", CompareRefresh);
}
}
}
Anonymous user