Skip to content

Instantly share code, notes, and snippets.

/**
* Builds a horizontal masonry in whats possbily (i haven't researched
* the techniques) a crude manner.
* Fits elements into columns if there is room and sets the width of
* the container element to contain all the columns.
*
* Known Issues:
* - Does not do anything clever for elements where height exceeds
* window height (probably just gets chopped off if overflow: hidden)
* - All elements are expected to be the column width
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<HTML>
<HEAD>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript" charset="utf-8">
$(document).ready(function() {
$('#form_div').submit(function() {
var inputs = [];
$(':input', this).each(function() {