Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I agree with John Boker that you will want to use height() rather than some method that counts the number of <code>li</code>s. The reason for this is that depending on the contents of the li, if it were a paragraph of text, it could have one <code>li</code> but be longer than a 2 <code>li</code> list with very short list items. </p> <pre><code>&lt;ul&gt; &lt;li&gt;Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla laoreet lacinia augue, a dignissim orci sagittis nec. Fusce blandit commodo felis, et aliquam orci auctor id. Vestibulum sagittis felis non urna condimentum gravida. Duis quam erat, facilisis nec rutrum sed, hendrerit non leo. Nam varius nunc eget dolor dictum sagittis rutrum sem rhoncus.&lt;/li&gt; &lt;/ul&gt; </code></pre> <ul> <li>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla laoreet lacinia augue, a dignissim orci sagittis nec. Fusce blandit commodo felis, et aliquam orci auctor id. Vestibulum sagittis felis non urna condimentum gravida. Duis quam erat, facilisis nec rutrum sed, hendrerit non leo. Nam varius nunc eget dolor dictum sagittis rutrum sem rhoncus.</li> </ul> <pre><code>&lt;ul&gt; &lt;li&gt;Short&lt;/li&gt; &lt;li&gt;Short 2&lt;/li&gt; &lt;/ul&gt; </code></pre> <ul> <li>Short</li> <li>Short 2</li> </ul> <p>Presuming that the <code>ul</code> is not floated or hidden, the method by John Boker will work. If that were the case, you would have to wait to hide or float them until their height has been measured.</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