title: How to trigger a function when a class is added and removed
body: <p>I want to trigger a function that add class for animate to nav li sequentially on  every time I toggle class for open menu</p>
  
  <pre><code>//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
  });
  </code></pre>