このメニューをご覧ください: http://maxim.comze.com
3番目のボタンはスライドパネルを開き、パネルを閉じます。すでに開いている場合は、他のボタンでもパネルを閉じてください。これは add acitem および if/else ステートメントと関係があることは知っていますが、それらの経験はありません。とても有難い。
これはメニューコードです:
$('li hometog, li jredtog, li servicestog',this).click(function(e){
e.stopImmediatePropagation();
var theElement=$(this).next();
var parent=this.parentNode.parentNode;
if($(parent).hasClass('noaccordion')){
if(theElement[0]===undefined){window.location.href=this.href}
$(theElement).slideToggle('normal',function(){
if($(this).is(':visible')){
$(this).prev().addClass('active')
}else{
$(this).prev().removeClass('active')}});
return false
}else{
if(theElement.hasClass('acitem')
&&theElement.is(':visible')){if($(parent).hasClass('collapsible')){
$('.acitem:visible',parent).first().slideUp('normal',function(){
$(this).prev().removeClass('active')
});
return false
}
return false
}
if(theElement.hasClass('acitem')&&!theElement.is(':visible')){
$('.acitem:visible',parent).first().slideUp('normal',function(){
$(this).prev().removeClass('active')});
theElement.slideDown('normal',function(){
$(this).prev().addClass('active')});
return false}
}
})
})
};
これは 3 番目のボタンのコードです。
$("servicestog").click(function(){
$(".panel").toggle("slide",{direction: "right"},500);
$(this).prev().addClass('active')
return false;
});