1 reply [Last post]
Last seen: 13 years 28 weeks ago
Joined: 2004-07-28
Posts: 4
Points: 2

Hi all

I'm adding elements to a DIV using Javascript at the moment. These elements are floated right, and the effect is that they appear in the top right corner, and are added to the left until there's no horizontal space, at which point they begin in the next row.

What I'd like to happen is that the elements are added below the previous, and if there's no room left vertically, they are added in the next column.

Any ideas?


Gausie Smile

Migstopheles's picture
Last seen: 13 years 18 weeks ago
Joined: 2009-11-12
Posts: 9
Points: 13

You'll need individual

You'll need to create columns for that, as far as I'm aware there's no way of laying out a page with "vertical floating"! Get your javascript to add a new column, count the number of divs being added inside it, and if they reach the threshold number, end the column div and open up a new one. If you don't know how tall your individual divs are going to be, you should be able to get the javascript to count the cumulative height of them instead of just the amount.

If I'm wrong and you *can* order things vertically without using a separating column, I'd be very interested to see how that works!