ここではかなり単純な問題ですが、それは少し私を盗んでいる。
私はアコーデオンのメニューを次のように設定しました:
そして、私はアコーディオンを実行するjQueryスクリプトを持っています:
function accordionMenu() {
$('ul.navigation ul').hide();
$('ul.navigation li a').click(
function() {
var parentElement = this.parentNode.parentNode.id;
var elementTest = $(this).next();
if((elementTest.is('ul')) && (elementTest.is(':visible'))) {
$('#' + parentElement + ' ul:visible').slideUp('fast');
$(this).removeClass('active');
return false;
}
if((elementTest.is('ul')) && (!elementTest.is(':visible'))) {
$('#' + parentElement + ' ul:visible').slideUp('fast');
elementTest.slideDown('fast');
$('ul.navigation a').removeClass('active');
$(this).addClass('active');
return false;
}
}
);
}
$(document).ready(function() {accordionMenu();});
Now I need to figure out how to loop through the list items, and find the ones that have lists following them (ie, the ones that when clicked, drop down to reveal the hidden list.). Then I need to add a span on the end of each one (inbetween and
). That's it really. It's just confusing me - how should I go about doing it?
Thanks,
Alex