Ok, the below changes lets you selectively disable the "collapseprevious" behavior for a particular switch content. In other words, it lets you collapse/expand a sub content within a switch content without affecting the entire switch content.
First, replace function expandcontent() within the code of step 1 with:
Code:
function expandcontent(curobj, cid, collapseprev){
var spantags=curobj.getElementsByTagName("SPAN")
var showstateobj=getElementbyClass(spantags, "showstate")
if (ccollect.length>0){
if (collapseprevious=="yes" && typeof collapseprev=="undefined")
contractcontent(cid)
document.getElementById(cid).style.display=(document.getElementById(cid).style.display!="block")? "block" : "none"
if (showstateobj.length>0){ //if "showstate" span exists in header
if (collapseprevious=="no")
showstateobj[0].innerHTML=(document.getElementById(cid).style.display=="block")? contractsymbol : expandsymbol
else
revivestatus()
}
}
}
Then, for the sub content, change the HTML code to:
Code:
<li onclick="expandcontent(this, 'subsub2', 'disablecollapse')">Link 1</li>
Notice the extra "disablecollapse" parameter added in this case.
Bookmarks