On Mon, Apr 6, 2009 at 11:50 AM, Sero <r...@combinecreative.com> wrote:
>
> Thanks, but sometimes I'll get an li with the text cut off through the
> middle.  Only the top half of the letters display - looks rough.
>

Good point. What about using a while loop, then?

$(function()
{
        adjustNewsHeight();
});

function adjustNewsHeight()
{
        var news_ul = $('#newsEvents ul');
        var max_height = 406;
        
        while (news_ul.height() > max_height)
        {
                $('li:last-child', news_ul).remove();
        }
}

Note that you have to remove the items, not just hide them. I think
that's a change in behaviour from the 1.2.x branch. If you want to
keep them available, I suppose you could set their height to 0 then
re-inflate them when you need them again.

Reply via email to