Note that there are some explanatory texts on larger screens.

plurals
  1. PONested UL Height
    text
    copied!<p>I have a menu with nested UL's to work as a drop down menu. In the drop down I have another nested UL with LI's that are pragmatically generated so I don't know how many are going to be in their.</p> <p>I was trying to set the height of the second UL on load so that I can put a border around the dropdown.</p> <p>HTML:</p> <pre><code>&lt;ul&gt; &lt;li&gt;1&lt;/li&gt; &lt;li&gt;2 &lt;ul&gt; &lt;li&gt;2a &lt;ul class="submenu"&gt; &lt;li&gt;2a1&lt;/li&gt; &lt;li&gt;2a2&lt;/li&gt; &lt;li&gt;2a3&lt;/li&gt; &lt;li&gt;2a4&lt;/li&gt; &lt;li&gt;2a5&lt;/li&gt; &lt;/ul&gt; &lt;/li&gt; &lt;li&gt;2b &lt;ul class="submenu"&gt; &lt;li&gt;2b1&lt;/li&gt; &lt;li&gt;2b2&lt;/li&gt; &lt;li&gt;2b2&lt;/li&gt; &lt;li&gt;2b2&lt;/li&gt; &lt;li&gt;2b2&lt;/li&gt; &lt;li&gt;2b2&lt;/li&gt; &lt;li&gt;2b2&lt;/li&gt; &lt;li&gt;2b2&lt;/li&gt; &lt;li&gt;2b2&lt;/li&gt; &lt;li&gt;2b2&lt;/li&gt; &lt;/ul&gt; &lt;/li&gt; &lt;/ul&gt; &lt;/li&gt; &lt;li&gt;3&lt;/li&gt; &lt;/ul&gt; </code></pre> <p>CSS:</p> <pre><code> ul { list-style-type: none; } ul li { display: inline-block; /*float: left;*/ width: 100px; } ul li:hover { background-color: #cc0505; color: white; } ul li ul { /*visibility: hidden;*/ position: absolute; padding: 0px; border: 2px solid black; /*min-height:120px;*/ } ul li:hover ul { visibility: visible; } ul li ul li { /*display: inline; float: left;*/ color: black; } ul li ul li:hover { background-color: white; color: black; } ul li ul li ul { border: none; min-height:0px; } ul li ul li ul li { display: block; /*float: none;*/ } ul li ul li ul li:hover { background-color: #cc0505; color: white; } </code></pre> <p>I have tried using <code>$('ul ul ul').each</code> and <code>$('ul ul ul').next()</code> to loop through any UL on the third level but it only seems to be picking up the first occurrence.</p> <p>A jsfiddle I set up with my code and a few attempts I have made to get this right. <a href="http://jsfiddle.net/kZ236/2/" rel="nofollow noreferrer">http://jsfiddle.net/kZ236/2/</a></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