Tiles in Javascript

less than 1 minute read

Tried using Freewall, a small tiling library written in jquery. It looked nice in the demos and easy to incorporate but didn’t like tiles composed dynamic ajax content. Even calling $(window).sendResize() after each block loaded and formatted, content would frequently overlap unless a height was specified in advance. Little documentation. Before trying the very popular Masonry I thought I would try some basic CSS, float-left, float-right on content and clear on a spacer div. Although layout is now hard-coded, it works and is easy for anyone to figure out. Simple CSS and layout is below.

The HTML: [sourcecode language=”html”]


And the CSS: [sourcecode language=”css”] .cell { width: 47%; padding: 10px; } .left { float: left } .right { float: right } .spacer { height: 20px; clear: both } [/sourcecode]