サイドバーのナビゲーションに jQuery アコーディオンを使用しています。現在、私は 2 つのリンクを持っていますが、どちらもその下に「子」があります。
これが私のjsFiddleです:http://jsfiddle.net/6Eh8C/
[About Us] をクリックすると、ギャラリーが閉じます。これは起こるべきではありません。ギャラリーは、[ギャラリー] をクリックしたときにのみ閉じる必要があります。
これを修正するにはどうすればよいですか?
これが私のjQueryです:
jQuery(function($) {
$('#accordion > li > a').click(function (e) {
if ($(this).next('ul').length == 0) {
// link is for navigation, do not set up accordion here
return;
}
// link is for accordion pane
//remove all the "Over" class, so that the arrow reset to default
$('#accordion > li > a').not(this).each(function () {
if ($(this).attr('rel')!='') {
$(this).removeClass($(this).attr('rel') + 'Over');
}
$(this).siblings('ul').slideUp("slow");
});
//showhide the selected submenu
$(this).siblings('ul').slideToggle("slow");
//addremove Over class, so that the arrow pointing downup
$(this).toggleClass($(this).attr('rel') + 'Over');
e.preventDefault();
});
$('.slides_item').children('div').css('background','#ededed')
});
ポインタをありがとう:-)