<li class="submenuList item-with-ul selected">
<a href="#">Blalab</a>
<ul class="sub-nav flexnav-show" style="display: block;">
<li><a href="#">Highlights</a></li>
<li><a href="#">Invited</a></li>
<li><a href="#">Talks</a></li>
</ul>
<span class="touch-button active"><i class="fa fa-chevron-down navicon"></i></span>
</li>
腳本:
$('.touch-button').on('click', function(e) {
var $touchButton;
$touchButton = $(this).parent('.item-with-ul').find('>span.touch-button');
$parent = $(this).parent('.item-with-ul');
$(".flexnav ul").removeClass('flexnav-show').hide();
$(this).parent().not('.selected').addClass('selected');
$('.selected').removeClass('selected');
//couldn't figure how to remove active from touch-button and add active as so to close and open the submenu
//$(this).removeClass('active');
// $touchButton.removeClass('active');
});
託管刪除/添加時,選擇點擊按鈕,其他子菜單列表。但是當點擊下一個子菜單列表中的下一個按鈕時,按鈕仍處於活動狀態。單擊下一個按鈕時,無法獲取要刪除或添加的活動。
不知道爲什麼它不工作(見註釋行)
你可以發佈小提琴嗎? – 2015-03-25 06:39:00