title: CSS Vertical Menu with Nested Lists, Need jQuery Delay on MouseOut
body: <p>I'm new with jQuery and I'm trying to solve an issue with my navigation. I built a vertical menu with many nested lists. It's purely CSS but my client requested that the sub menu currently open stays open for a second or so when you're no longer hovering over it.</p>
  
  <p>Here's the site I'm working on: <a href="http://dev.musgraveagencies.com/" rel="nofollow">http://dev.musgraveagencies.com/</a></p>
  
  <p>And here is the site they currently have, and how they want the menu to delay: <a href="http://www.musgraveagencies.com/" rel="nofollow">http://www.musgraveagencies.com/</a></p>
  
  <p>I believe I can use jQuery to achieve this, but I want the site to work as is if Javascript isn't enabled.</p>
  
  <p><strong>Edit:</strong> Thanks for everyone's help! Here is the final code below.</p>
  
  <p>My HTML:</p>
  
  <pre><code>&lt;body class="nojs"&gt;
          &lt;div id="nav"&gt;
          &lt;ul&gt;
              &lt;li&gt;&lt;a href="#"&gt;Home&lt;/a&gt;&lt;/li&gt;
              &lt;li&gt;&lt;a href="#"&gt;Development Projects&lt;/a&gt;
                  &lt;ul&gt;
                      &lt;li&gt;&lt;a href="#"&gt;Design Build&lt;/a&gt;
                          &lt;ul&gt;
                              &lt;li&gt;&lt;a href="#"&gt;Interior Design&lt;/a&gt;
                                  &lt;ul&gt;
                                      &lt;li&gt;&lt;a href="#"&gt;Project Example&lt;/a&gt;&lt;/li&gt;
                                  &lt;/ul&gt;
                              &lt;/li&gt;
                              &lt;li&gt;&lt;a href="#"&gt;Project Example 1&lt;/a&gt;&lt;/li&gt;
                              &lt;li&gt;&lt;a href="#"&gt;Project Example 2&lt;/a&gt;&lt;/li&gt;
                              &lt;li&gt;&lt;a href="#"&gt;Project Example 3&lt;/a&gt;&lt;/li&gt;
                          &lt;/ul&gt;
                      &lt;/li&gt;
                      &lt;li&gt;&lt;a href="#"&gt;Industrial&lt;/a&gt;
                          &lt;ul&gt;
                              &lt;li&gt;&lt;a href="#"&gt;Project Example 1&lt;/a&gt;&lt;/li&gt;
                              &lt;li&gt;&lt;a href="#"&gt;Project Example 2&lt;/a&gt;&lt;/li&gt;
                              &lt;li&gt;&lt;a href="#"&gt;Project Example 3&lt;/a&gt;&lt;/li&gt;
                              &lt;li&gt;&lt;a href="#"&gt;Project Example 4&lt;/a&gt;&lt;/li&gt;
                          &lt;/ul&gt;
                      &lt;/li&gt;
                      &lt;li&gt;&lt;a href="#"&gt;Residential&lt;/a&gt;&lt;/li&gt;
                      &lt;li&gt;&lt;a href="#"&gt;Neighbourhood&lt;/a&gt;&lt;/li&gt;
                  &lt;/ul&gt;
              &lt;/li&gt;
              &lt;li&gt;&lt;a href="#"&gt;Contact&lt;/a&gt;&lt;/li&gt;
          &lt;/ul&gt;
          &lt;/div&gt;
      &lt;/div&gt;
  &lt;/body&gt;
  </code></pre>
  
  <p>My CSS:</p>
  
  <pre><code>#nav {
      width: 156px;
      font: 9pt 'TeXGyreScholaRegular', Arial, sans-serif;
      text-align: left;
  }
  
  #nav ul a {
      color: #fff;
      display: block;
      overflow: auto;
      line-height: 19pt;
      text-indent: 2px;
  }
  
  #nav ul a:hover {
      color: #fff;
      text-decoration: none;
  }
  
  #nav ul li:hover {
      background: #484848;
  }
  
  #nav ul {
      width: 156px;
  }
  
  #nav ul li {
      list-style: none;
      background: #000;
      position: relative;
      z-index: 100;
  }
  
  #nav ul li ul {
      position: absolute;
      width: 156px;
      top: 0;
      left: 156px;
  }
  
  body.nojs #nav ul li ul  {
      display: none;
  }
  
  body.nojs #nav ul li:hover &gt; ul {
      display: block;
  }
  </code></pre>
  
  <p>My jQuery:</p>
  
  <pre><code>&lt;script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"&gt;&lt;/script&gt;
  &lt;script type="text/javascript" src="js/jquery.hoverIntent.minified.js"&gt;&lt;/script&gt;
  &lt;script type="text/javascript"&gt;
      $(document).ready(function() {
          $('#nav ul li ul').hide();
          $('body').removeClass('nojs');
  
          var config = {    
              sensitivity: 2, 
              interval: 200,    
              timeout: 700, 
          };
  
          var animating = false;
  
          $('#nav ul li').hoverIntent(
          function () {
                  animating = true;
                  $('&gt; ul', this).fadeIn(100, function() {
                      animating = false;
                  });
          },
  
          function () {
              animating = true;
              $('&gt; ul', this).delay(400).fadeOut(200, function() {
                  animating = false;
              });
          });
      });
  &lt;/script&gt;
  </code></pre>