Menu Problems

2 posts by 2 authors in: Forums > CMS Builder
Last Post: January 18, 2011   (RSS)

Hi Everyone

I know this may not be the most appropriate forum for my issue, but I thought someone might be able to help me. I am using CMSB for a condo corp website, specifically to display the Policy Manual. I have created a table of content menu system (file attached) which works very well. However, there is one problem. When I choose a TOC sub-item, the menu then collapses (see http://www.huntclubestates66.com/policyManual.php). I would like it not to collapse; otherwise it is very irritating because you can't easily tell where you were when reading a sub-menu item.

The TOC menu is controlled by a javascript function listed below.
<script type="text/javascript">


CLOSED_IMAGE='images/toc-plus.png';
OPEN_IMAGE='images/toc-minus.png';


function makeCollapsible(listElement){

// removed list item bullets and the sapce they occupy
listElement.style.listStyle='none';
listElement.style.marginLeft='0';
listElement.style.paddingLeft='0';

// loop over all child elements of the list
var child=listElement.firstChild;
while (child!=null){

// only process li elements (and not text elements)
if (child.nodeType==1){

// build a list of child ol and ul elements and hide them
var list=new Array();
var grandchild=child.firstChild;
while (grandchild!=null){
if (grandchild.tagName=='OL' || grandchild.tagName=='UL'){
grandchild.style.display='none';
list.push(grandchild);
}
grandchild=grandchild.nextSibling;
}

// add toggle buttons
var node=document.createElement('img');
node.setAttribute('src',CLOSED_IMAGE);
node.setAttribute('class','collapsibleClosed');
node.onclick=createToggleFunction(node,list);
child.insertBefore(node,child.firstChild);

}

child=child.nextSibling;
}

}


function createToggleFunction(toggleElement,sublistElements){

return function(){

// toggle status of toggle gadget
if (toggleElement.getAttribute('class')=='collapsibleClosed'){
toggleElement.setAttribute('class','collapsibleOpen');
toggleElement.setAttribute('src',OPEN_IMAGE);
}else{
toggleElement.setAttribute('class','collapsibleClosed');
toggleElement.setAttribute('src',CLOSED_IMAGE);
}

// toggle display of sublists
for (var i=0;i<sublistElements.length;i++){
sublistElements.style.display=
(sublistElements.style.display=='block')?'none':'block';
}

}

}

</script>


This code was written months ago, and I've lost track of how to fix the issue![blush]

Help!

Ragi
--
northernpenguin
Northern Penguin Technologies

"Any sufficiently advanced technology
is indistinguishable from magic."
........Arthur C. Clarke
Attachments:

policymanual_001.php 15K