我無法弄清楚如何爲這個手風琴家添加一個活躍狀態。我覺得我很近,但我必須點擊兩次,以便箭頭狀態改變。任何想法我做錯了什麼?爲我的生活添加一個jquery活動狀態給一個手風琴家
$('ul.expand').each(function(){
$('li.md', this).filter(':first').addClass('top').end().filter(':not(.open)').next().hide();
$('li.md', this).click(function(){
if($(this).hasClass('open')) {
$(this).find('.arrow').addClass('active');
return false;
} else {
$(this).find('.arrow').removeClass('active');
$(this).parent().find('li.md').removeClass('open').next().filter(':visible').slideUp();
$(this).addClass('open').next().slideDown();
$(this).find('.arrow').addClass('active');
}
});
});
這裏是HTML:
http://www.lastyearsloss.com/mav/mobile/
從查看你的代碼,我會說可以做很多優化。 – 2011-01-19 16:38:59
您鏈接中的JavaScript與您在此處發佈的內容不同:S – 2011-01-19 16:44:12