我想觸發的動畫李順序導航添加類上的每個I切換類開放式菜單如何觸發一個函數當一個類被添加和刪除
//this is my script
$(document).ready(function() {
document.querySelector("#nav-toggle")
.addEventListener("click", function() {
this.classList.toggle("active");
$(".menu-wrapper").toggleClass("show-menu");
}); // menu toggle class function
}); //add class for menu
var addClassToEl = function($el) {
$el.addClass('nav-reveals'); // addclass sequentially to nav elements
};
$('.side-menu li').each(function(i, el) {
setTimeout(function() {addClassToEl($(el))}, i++ * 200);
//set delay for each elements
});
檢查此鏈接 http://stackoverflow.com/questions/19401633/how-to-fire-an-event -on-class-change-using-jquery –
我已經試過了。它不適合我 –