Note that there are some explanatory texts on larger screens.

plurals
  1. PONeed some help to build a top menu
    text
    copied!<p>I need to build a top menu similar to this: <a href="http://delaespada.com" rel="nofollow">http://delaespada.com</a></p> <p>Here's where i'm at:</p> <p>HTML</p> <pre><code>&lt;div class="wrap"&gt; &lt;div id="panel1"&gt; &lt;h1&gt;PANEL1&lt;/h1&gt; &lt;/div&gt; &lt;div id="panel2"&gt; &lt;h1&gt;PANEL2&lt;/h1&gt; &lt;/div&gt; &lt;div id="panel3"&gt; &lt;h1&gt;PANEL3&lt;/h1&gt; &lt;/div&gt; &lt;div id="panel4"&gt; &lt;h1&gt;PANEL4&lt;/h1&gt; &lt;/div&gt; &lt;div id="panel5"&gt; &lt;h1&gt;PANEL5&lt;/h1&gt; &lt;/div&gt; &lt;/div&gt;&lt;!--end wrap--&gt; &lt;ul class="nav"&gt; &lt;li&gt;&lt;a class="1" href="#"&gt;link1&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a class="2" href="#"&gt;link2&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a class="3" href="#"&gt;link3&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a class="4" href="#"&gt;link4&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a class="5" href="#"&gt;link5&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; </code></pre> <p>JQUERY</p> <pre><code>$(document).ready(function(){ $("a.1").click(function(event){ event.preventDefault(); $("#panel2").css({height:0,top:-500}); $("#panel3").css({height:0,top:-500}); $("#panel4").css({height:0,top:-500}); $("#panel5").css({height:0,top:-500}); $("#panel1").css({height:150,top:20}); }); $("a.2").click(function(event){ event.preventDefault(); $("#panel1").css({height:0,top:-500}); $("#panel3").css({height:0,top:-500}); $("#panel4").css({height:0,top:-500}); $("#panel5").css({height:0,top:-500}); $("#panel2").css({height:150,top:20}); }); $("a.3").click(function(event){ event.preventDefault(); $("#panel1").css({height:0,top:-500}); $("#panel2").css({height:0,top:-500}); $("#panel4").css({height:0,top:-500}); $("#panel5").css({height:0,top:-500}); $("#panel3").css({height:150,top:20}); }); $("a.4").click(function(event){ event.preventDefault(); $("#panel1").css({height:0,top:-500}); $("#panel2").css({height:0,top:-500}); $("#panel3").css({height:0,top:-500}); $("#panel5").css({height:0,top:-500}); $("#panel4").css({height:150,top:20}); }); $("a.5").click(function(event){ event.preventDefault(); $("#panel1").css({height:0,top:-500}); $("#panel2").css({height:0,top:-500}); $("#panel3").css({height:0,top:-500}); $("#panel4").css({height:0,top:-500}); $("#panel5").css({height:150,top:20}); }); $(".wrap").mouseleave(function(){setTimeout(function(){$("#panel1, #panel2, #panel3, #panel4, #panel5").css({height:0,top:-500})},2000); }); }); </code></pre> <p>Is there a way to simplify the jquery code?</p> <p>Sometimes the setTimeOut function is working strange, what i'm doing wrong? and i also need a way to stop the setTimeOut function when the mouse is back in the panel.</p> <p>Please take a look <a href="http://jsfiddle.net/aPzSP/1/" rel="nofollow">http://jsfiddle.net/aPzSP/1/</a></p> <p>Thanks in advance</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload