title: Delay Toggling For One Of Multiple Elements in On Click
body: <p>I have the basic function below which toggles the same '.closed' class for two different elements at the same time. I need to find a solution to change NAV element's class with some delay. I tried to use the delay() but as far I as understand it works only with animated elements.</p>
  
  <p>I was able to opdain the effect I want only by adding CSS transition to the NAV element, but would like to have JQuery solution. Could you please direct me to a right solutions. Thanks</p>
  
  <p>NOTE: I use JQuery UI to add duration to toggleClass</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>$('.menu-items').click(function(){
    $(this).toggleClass('active');
    $('.menu-item, nav').toggleClass("closed", 500); //this one to be changed
  });</code></pre>
  <pre class="snippet-code-css lang-css prettyprint-override"><code>nav{
    position: fixed;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: 9999 ;
  }
  nav.closed{
    z-index: 0 !important;
  }
  
  nav .menu-item{
    position: absolute;
    height: 100%;
    width: 25%;
    -webkit-background-size: cover !important;
    -moz-background-size: cover !important;
    -o-background-size: cover !important;
    background-size: cover !important;
    cursor: pointer;
  }
  #m1.closed,
  #m2.closed,
  #m3.closed,
  #m4.closed{
    left: 0;
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"&gt;&lt;/script&gt;
  
  
  &lt;nav&gt;
    &lt;div id="m1" class="menu-item"&gt;
      &lt;div class="inner ab-ctr"&gt;
        &lt;h2 class="ab-ctr"&gt;menu1&lt;/h2&gt;
      &lt;/div&gt;
    &lt;/div&gt;
    &lt;div id="m2" class="menu-item"&gt;
      &lt;div class="inner ab-ctr"&gt;
        &lt;h2 class="ab-ctr"&gt;menu2&lt;/h2&gt;
      &lt;/div&gt;
    &lt;/div&gt;
    &lt;div id="m3" class="menu-item"&gt;
      &lt;div class="inner ab-ctr"&gt;
        &lt;h2 class="ab-ctr"&gt;menu3&lt;/h2&gt;
      &lt;/div&gt;
    &lt;/div&gt;
    &lt;div id="m4" class="menu-item"&gt;
      &lt;div class="inner ab-ctr"&gt;
        &lt;h2 class="ab-ctr"&gt;menu4&lt;/h2&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/nav&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>UPDATE: Guys, thanks for answers. But I didn't take to consideration that I need different timing only for the "close" class. As an example, I need to change NAVs class in one second after I changed '.menu-item's class (I already did it with setInteval), however once I toggle back the NAV has to change its value immediately without any delay. Is it also possible with setInterval or I need to find another less complicated solution? :)</p>