i have a vertical menu bar which contains sub menu. There are 9-10 menus and each menu contains 3 sub menus.
what i need if menu 1 is open and someone click on menu 3 menu 1 should close & menu 3 will open
$('#nav li a').click(function(){
var sds = document.getElementById("dum");
if(sds == null){
;
}
var sdss = document.getElementById("dumdiv");
if(sdss == null){
}
if(sdss != null){
var s = $(this).attr('id');
var imgid=$("#"+s+" img").attr('id');
var imgsrc=$("#"+imgid+"").attr('src');
if(imgsrc=="images/insert.GIF")
{
$("#"+imgid+"").attr('src','images/remove.GIF');
$(this).next().slideDown(400);
$("#"+s+"").css("background-color","#142878");
}
else
{
$("#"+imgid+"").attr('src','images/insert.GIF');
$(this).next().slideUp(400);
$("#"+s+"").css("background-color","#2d539a");
}
}
});
Try this:
$('.count').slideUp(400); //<----add this line
$(this).next().slideDown(400);
try this:
if (imgsrc == "images/insert.GIF") {
$("#" + imgid + "").attr('src', 'images/remove.GIF');
$('.count').slideUp(400);
$(this).next().slideDown(400);
$("#" + s + "").css("background-color", "#142878");
} else {
$("#" + imgid + "").attr('src', 'images/insert.GIF');
$('.count').slideUp(400); //<--------------------add here
$(this).next().slideDown(400); //<---------------and here too.
$("#" + s + "").css("background-color", "#2d539a");
}