I've got a div needs to show the first three items in a list, if that list is bigger than three items, I'd like a button to trigger to expand to reveal all the items. It's possible for me to find out how many items will be in the list via PHP, but this number could be from 0 to 30.
<style type="text/css">
.box {
height: 80px;
overflow: hidden;
}
.box li {
height: 20px;
background: red;
}
</style>
<div class="box">
<ul>
<li>Item 1</li>
<li>Item 2</li>
<li>Item 3</li>
<li>Item 4</li>
</ul>
</div>
<a href="#show-all">Show All</a>
Is there a way I can automatically find the correct height that div needs to expand to? or is there a way I can simply let jQuery expand the div until all of the list elements are visible?