Note that there are some explanatory texts on larger screens.

plurals
  1. POMy simple jquery dropdown function is bugged and glitchy
    primarykey
    data
    text
    <p>I am trying to create a simple jquery dropdown function that will let me show blocks of info on hover over menu elements. At this point what I made so far is bugged and glitchy if you mouse over too fast. Also the dropdown seems to stay visible only while hovering the element and not on its child.</p> <p>Maybe someone could have a quick look at the code and suggest how to implement some sort of flags so the menue does not go away easy and dont get glitchy on multiple mouse hovers.</p> <p>You will probably ask why I dont do it by pure css, unfortunately I need older browsers support and prefer to wrap it one function.</p> <p>jsbin: <a href="http://jsbin.com/inedoy/1" rel="nofollow">http://jsbin.com/inedoy/1</a></p> <p>Here is the code:</p> <pre><code>&lt;!DOCTYPE html&gt; &lt;html class="no-js"&gt; &lt;head&gt; &lt;meta charset="utf-8"&gt; &lt;style&gt; body {margin:60px; font-family: sans-serif; font-size:12px;} ul {margin:0;padding:0;} ul li { position:relative; list-style-type: none; padding:5px 0; border-bottom:1px solid #ddd; } .dropdown { display:none; position:absolute; width:200px; border:1px solid #ddd; padding:20px; top:40px; left:0; } &lt;/style&gt; &lt;/head&gt; &lt;body&gt; &lt;ul&gt; &lt;li class="drop"&gt;Some link &lt;div class="dropdown"&gt; &lt;ul&gt; &lt;li&gt;Lorem ipsum dolor sit amet, consectetuer adipiscing elit.&lt;/li&gt; &lt;li&gt;Aliquam tincidunt mauris eu risus.&lt;/li&gt; &lt;li&gt;Vestibulum auctor dapibus neque.&lt;/li&gt; &lt;li&gt;Lorem ipsum dolor sit amet, consectetuer adipiscing elit.&lt;/li&gt; &lt;li&gt;Aliquam tincidunt mauris eu risus.&lt;/li&gt; &lt;li&gt;Vestibulum auctor dapibus neque.&lt;/li&gt; &lt;li&gt;Lorem ipsum dolor sit amet, consectetuer adipiscing elit.&lt;/li&gt; &lt;li&gt;Aliquam tincidunt mauris eu risus.&lt;/li&gt; &lt;li&gt;Vestibulum auctor dapibus neque.&lt;/li&gt; &lt;/ul&gt; &lt;/div&gt; &lt;/li&gt; &lt;/ul&gt; &lt;script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"&gt;&lt;/script&gt; &lt;script&gt; dropdown('.drop','.dropdown'); function dropdown(hoverElement,toShow){ $(hoverElement).hover(function(){ $(toShow).stop().slideDown(); },function(){ setTimeout(function(){ $(toShow).stop().hide(); },300); }); } &lt;/script&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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