私は動作する単純なjQueryアコーディオンを持っています...ほぼ完璧に:)
デモからわかるように、現在、「チーム」ページにいるので、ナビゲーションを「開いています」。
「AboutUs」をクリックすると、要素が完全に閉じます。デモからわかるように、閉じますが、すぐに再度開きます。これは、CSSの27行目のコードが原因で発生していると思います。
これが私のデモです:http ://jsfiddle.net/URYzK/5/
これが私のJavaScriptです:
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();
});
});
ここで助けてくれてありがとう。