Note that there are some explanatory texts on larger screens.

plurals
  1. POjquery toggle dropdown menu problem (css)
    primarykey
    data
    text
    <p>i am trying to implement jquery's toggle method to make a dropdown menu, it actually works just fine, the only problem is that the dropdown menu pushed its parent container and it seems like it add some height to it, it kinda hard for me to say this but let me show some of my html and css </p> <p>Html:</p> <pre><code>&lt;div id="header_container"&gt; &lt;h1&gt;This is Header&lt;/h1&gt; &lt;div id="personal_menu"&gt; &lt;ul&gt; &lt;li&gt; Welcome back user! &lt;/li&gt; &lt;li class="main_link"&gt; &lt;a href="#"&gt;My links&lt;/a&gt; &lt;ul class="sublink" style="display: block;"&gt; &lt;li&gt;&lt;a href="#"&gt;link 1&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#"&gt;link 2&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#"&gt;link 3&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#"&gt;link 4&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; &lt;/li&gt; &lt;li&gt; &lt;a href="#"&gt;Logout&lt;/a&gt; &lt;/li&gt; &lt;/ul&gt; &lt;/div&gt; &lt;/div&gt; </code></pre> <p>CSS</p> <pre><code>#header_container{ width:960px; overflow:auto; padding: 10px 15px; margin: 0 auto; } #header_container{ background:#BED308; height:218px; -moz-border-radius: 0 0 40px 40px; border-radius: 0 0 40px 40px; } #personal_menu{ overflow: auto; position: relative; right: 0; top: 135px; width: 100%; } #personal_menu ul, #main_menu ul{ list-style-type:none;} #personal_menu ul{ float: right; margin-top: 5px; } #personal_menu li{ float: left; text-align: center; } #personal_menu li{ margin: 0; padding: 3px 5px; } #personal_menu li a{ color: #fff; text-decoration:none; } #personal_menu li a:hover{ text-decoration:underline; } #personal_menu ul li ul { display: none; position: absolute; width: 160px; border: 1px solid #ccc; padding: 10px 0; z-index: 1000; } </code></pre> <p>and jquery:</p> <pre><code>$(function() { $(".main_link").click(function(){ $(".sublink").toggle(); }); }); </code></pre> <p>so when i click the main_link class, the toggled sublink stays inside the header container making my header scrollable, i have tried to put some z-index rule to my sublink because i figure that it need to be on top of everything else but still no luck, please help.</p> <p>Thanks</p>
    singulars
    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.
 

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