Skip to content

Instantly share code, notes, and snippets.

@michaelcarwile
Created November 5, 2013 20:31
Show Gist options
  • Save michaelcarwile/7325721 to your computer and use it in GitHub Desktop.
Save michaelcarwile/7325721 to your computer and use it in GitHub Desktop.
Change the height of all list items in order to float properly with jQuery
//* Originally found: http://www.nikolakis.net/2011/07/change-the-height-of-all-list-items-to-float-properly-with-jquery/
/* example HTML
<ul class="list">
<li>some information</li>
<li>some more information</li>
<li>even more information</li>
</ul>
*/
/* make sure jquery is loading, then use */
$(document).ready(function() {
var maxheight = 0;
$('.list li').each(function(){
if (maxheight < $(this).height()) {
maxheight = $(this).height();
}
});
$('.list li').height(maxheight);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment