hey guys i have this function, i have hidden divs under each a:link in my nav and onclick it shows them sliding down while pushing the rest of the nav down and to close it i have to click the a:link again. Im wondering if there is something to add in my function that when you have one hidden div open it automatically closes when you click a second a:link so a user doesnt have more then one hidden div open at a time heres my function.
function toggle_div(div_id) {
var div = $(‘#’+div_id);
var divs = $(‘#main-nav’).children(‘div’).not(div);
if(div.css(‘display’) == ‘none’)
{
divs.slideUp(function() {
div.slideDown();
});
}
else
{
div.slideUp();
}
}