Here's one way: $(function(){ newRowAt = 5; inc = newRowAt - 1; $('li').each(function(i){ if(newRowAt == i + 1){ $(this).css('clear','left'); newRowAt += inc; } }); });
- jason On Mar 7, 4:52 pm, Shelane <[EMAIL PROTECTED]> wrote: > I did this: $('ul li:nth-child(5n)').css("clear","both"); > > It's still having a strange output: > > http://education.llnl.gov/sme/photos.lasso > > On Mar 7, 1:33 pm, Shelane <[EMAIL PROTECTED]> wrote: > > > I basically want to create a grid of items from a list. For example I > > want a new row after every 4th element. So I will have all of these > > elements doing a float left, but I need to do a clear:all after each > > 4th element. > > > The end goal is to be able to do a sortable or drag and drop to > > reorder these items (pictures arranged in an album). I'd kind of like > > to do something like Flickr (if you've seen how they rearrange photos > > in an album). > > > Has anyone done anything like that? I'm hoping the new UI version > > might lend aid in the final product.