Otherwise use that jQuery you have there. One thing that might make it easier is to style the ul as it would look with 4 or more li’s in it as default. Then override some css when there’s 3 li’s or less. That way I think you’ll end up with fewer LOC.
@AntonNiklasson — yes, that is PDN (pretty darn neat). I’ve been coming across more and more references to Lea Verou’s work of late. I’m going to have to explore it a bit more thoroughly. Many interesting ideas/solutions to similar such problems.