我在演示中使用了一個基本的jQuery Accordion。我點擊「關於我們」,它會顯示下方的「團隊」鏈接。好極了!對jQuery Accordion稍作調整
現在,是否有可能讓這個手風琴上班沒有必須在超鏈接中有'item'類?
因此,而不是<a href="/about-us/" class="item">About Us</a>
它只是<a href="/about-us/">About Us</a>
?我問的原因是目前從WordPress生成的代碼不包括'item'類,因此打破了我的手風琴。
這裏是我的演示:http://jsfiddle.net/h32dj/
而且我的JavaScript:
jQuery(function($) {
$('#accordion a.item').click(function (e) {
//remove all the "Over" class, so that the arrow reset to default
$('#accordion a.item').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();
});
});
這裏任何指針:)感謝
演示精美的作品!謝謝!!!現在我要嘗試並融入我的解決方案。回到2分鐘:) – michaelmcgurk 2013-03-05 11:11:58
這很好用 - 很多,非常感謝您的詳細回覆和解決方案。祝你有美好的一天!!! – michaelmcgurk 2013-03-05 11:13:23
Hi @Andrei。我現在注意到的只有輕微的問題是,當我點擊「新聞」時,它不會導航到任何地方。有沒有解決的辦法? – michaelmcgurk 2013-03-05 11:38:31