I found a solution afterwords combining javascript and css.
I used the following code the the window.onresize event :
Code:
window.onresize = function(event) {
var rightPaneDivs = document.getElementById("rightPane").getElementsByTagName("div");
// loop through the divs to the one containing the category links
for(i=0; i < rightPaneDivs.length; i++)
{
// once the appropriate div has been found
if(rightPaneDivs[i].className == 'content_pane_contents')
{
var categoryLinks = rightPaneDivs[i].getElementsByTagName('a');
// make sure there are currently some category links resent
if(categoryLinks.length > 0)
{
/* determine the width of the div, the width of the category links inside it,
use integer division to get the number of columns that can fit inside,
use this number while looping through the category links to determine
which ones need to have the clear attribute set to "left" in order to
force it onto a new line */
var contentPaneOffsetWidth = parseInt(rightPaneDivs[i].offsetWidth) - parseInt(getStyle(rightPaneDivs[i], 'paddingLeft').replace(/[^0-9]+/g, ''));
var columnsWidth = parseInt(categoryLinks[0].offsetWidth) + parseInt(getStyle(categoryLinks[0], 'marginLeft').replace(/[^0-9]+/g, '') * 2);
var totalColumns = Math.floor(contentPaneOffsetWidth / columnsWidth);
for(j=0; j < categoryLinks.length; j++)
categoryLinks[j].style.clear = (j % totalColumns == 0) ? 'left' : 'none';
}
}
}
}
Plus I made use of this cross-browser function to retrieve css properties from an external stylesheet
Code:
function getStyle(el, cssprop) {
if (el.currentStyle) //IE
return el.currentStyle[cssprop]
else if (document.defaultView && document.defaultView.getComputedStyle) //Firefox
return document.defaultView.getComputedStyle(el, "")[cssprop]
else //try and get inline style
return el.style[cssprop]
}
Bookmarks