0
我爲我的側邊欄導航使用了jQuery Accordion。目前我有兩個鏈接,其中都有「孩子」。jQuery Accordion的基本問題
這裏是我的jsfiddle:http://jsfiddle.net/6Eh8C/
你會發現,當你點擊「關於我們」,畫廊關閉。這不應該發生。只有點擊「圖庫」後,圖庫才應該關閉。
我該如何解決這個問題?
這裏是我的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')
});
爲:-)
哇。我真的應該看到這一點。非常感謝如此快速的回覆。 – michaelmcgurk 2013-03-17 18:55:33
完美無缺 - 非常感謝。將在5分鐘內接受答案:) – michaelmcgurk 2013-03-17 18:56:51
@michaelmcgurk:沒問題!樂意效勞。 – 2013-03-17 18:57:27