virginiachic
Technical User
I am totally new to Javascript and I currently have a code I am using to expand a div on click and then collapse it on click. However, I need to change/add to it so that when one div is clicked the others that are open collapse (i.e., only one div can be open at a time). I have no idea how to modify the code so that it does this - I tried using a canned code off the internet but it messed up with the accordion effect of the content.
Here is the page (the 3 sections that expand/collapse are the left side navigation - so only one of them should be open showing the sublinks at a time):
Here is the code that I am using:
function expcoll(div) {
var el = document.getElementById(div);
if ( el.style.display == "none" ) {
el.style.display = '';
}
else {
el.style.display = 'none';
}
}
Thank you for your help!!
Here is the page (the 3 sections that expand/collapse are the left side navigation - so only one of them should be open showing the sublinks at a time):
Here is the code that I am using:
function expcoll(div) {
var el = document.getElementById(div);
if ( el.style.display == "none" ) {
el.style.display = '';
}
else {
el.style.display = 'none';
}
}
Thank you for your help!!