0
廣東話工作似乎得到這個工作的第一次點擊jQuery的.animate不是第一次點擊
$(document).ready(function() {
var expand = $('.expand-icon');
$(expand).on('click', function() {
$(this).children('i').toggleClass('fa-plus fa-minus');
$(this).closest("li").find(".submenu").eq(0).toggleClass('active')
.animate({
height: 'toggle'
});
});
});
鏈接到演示https://codepen.io/MistaNeilo/pen/mBvdrp
它擴大,但然後立即關閉。 – Barmar
'.toggleClass('active')'顯示菜單,然後'animate'通過將其高度設置爲0來解除它。 – Barmar