title: jQuery: menus appear/disappear on click
body: <p>I've been looking all over the web and I can't find a solution. I am very new to jQuery as well.</p>
  
  <p><strong>My case:</strong></p>
  
  <p>I have a nav bar, each link in it activates/triggers a megamenu (each link has its own megamenu).</p>
  
  <p><strong>What I need:</strong></p>
  
  <p>I need a way to have each link activate its own megamenu, the megamenu should close when:</p>
  
  <ol>
  <li><p>The user clicks on another item in the nav bar.</p></li>
  <li><p>The user clicks on the same item in the nav bar.</p></li>
  <li><p>The user clicks on a 'close button' (X) graphic inside the megamenu (not shown in the HTML for simplicity sake).</p></li>
  </ol>
  
  <p><strong>HTML:</strong></p>
  
  <pre><code>&lt;div id="top-nav"&gt;
   &lt;ul&gt;
    &lt;li&gt;&lt;span&gt;Products &amp;amp; Services&lt;/span&gt;
      &lt;ul&gt;
        &lt;li&gt;&lt;div class="megamenu"&gt;Content here...&lt;/div&gt;&lt;/li&gt;
      &lt;/ul&gt;
    &lt;/li&gt;
    &lt;li&gt;&lt;span&gt;Support &amp;amp; Training&lt;/span&gt;
      &lt;ul&gt;
       &lt;li&gt; &lt;div class="megamenu"&gt;Content here...&lt;/div&gt;&lt;/li&gt;
      &lt;/ul&gt;
    &lt;/li&gt;
    &lt;li&gt;&lt;span&gt;Communities&lt;/span&gt;
      &lt;ul&gt;
       &lt;li&gt; &lt;div class="megamenu"&gt;Content here...&lt;/div&gt;&lt;/li&gt;
      &lt;/ul&gt;
    &lt;/li&gt;
    &lt;li&gt;&lt;span&gt;Store&lt;/span&gt;
      &lt;ul&gt;
        &lt;li&gt;&lt;div class="megamenu"&gt;Content here...&lt;/div&gt;&lt;/li&gt;
      &lt;/ul&gt;
    &lt;/li&gt;
   &lt;/ul&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>I've seen the script of 'Sexy Drop Down Menu' but the problem is that it closes the menu triggered by the click on hover, and as I said, I'm new to jQuery and I can't figure out a way to adapt it to what I need.</p>
  
  <p><a href="http://www.sohtanaka.com/web-design/examples/drop-down-menu/" rel="nofollow">http://www.sohtanaka.com/web-design/examples/drop-down-menu/</a></p>
  
  <p>Any help would be greatly appreciated.</p>
  
  <p>Thanks.</p>