mirror of https://github.com/metafizzy/isotope
Filter & sort magical layouts
http://isotope.metafizzy.co
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
192 lines
5.0 KiB
192 lines
5.0 KiB
14 years ago
|
---
|
||
|
|
||
14 years ago
|
title: Layout modes
|
||
14 years ago
|
category: docs
|
||
14 years ago
|
layout: default
|
||
14 years ago
|
body_class: option-def
|
||
14 years ago
|
toc:
|
||
13 years ago
|
- { title: Horizontal layouts, anchor: horizontal_layouts }
|
||
14 years ago
|
- { title: cellsByColumn, anchor: cellsbycolumn }
|
||
14 years ago
|
- { title: cellsByRow, anchor: cellsbyrow }
|
||
|
- { title: fitColumns, anchor: fitcolumns }
|
||
14 years ago
|
- { title: fitRows, anchor: fitrows }
|
||
|
- { title: masonry, anchor: masonry }
|
||
|
- { title: masonryHorizontal, anchor: masonryhorizontal }
|
||
14 years ago
|
- { title: straightAcross, anchor: straightacross }
|
||
|
- { title: straightDown, anchor: straightdown }
|
||
13 years ago
|
- { title: Modified layout modes, anchor: modified_layout_modes }
|
||
14 years ago
|
|
||
|
---
|
||
|
|
||
14 years ago
|
Isotope has a versatile layout engine that can accommodate multiple layout modes. You can set and change the layout mode via the `layoutMode` option.
|
||
14 years ago
|
|
||
14 years ago
|
[**See Demo: Layout modes**](../demos/layout-modes.html)
|
||
14 years ago
|
|
||
14 years ago
|
### Example
|
||
|
|
||
|
{% highlight javascript %}
|
||
|
|
||
14 years ago
|
$('#container').isotope({ layoutMode : 'fitRows' });
|
||
14 years ago
|
|
||
|
{% endhighlight %}
|
||
|
|
||
14 years ago
|
Several layout modes are built into Isotope.
|
||
14 years ago
|
|
||
13 years ago
|
### Horizontal layouts
|
||
|
|
||
|
Horizontal layout modes (masonryHorizontal, fitColumns, cellsByColumn, and straightAcross) need a container that has a height value. Be sure that your CSS has height set.
|
||
|
|
||
|
{% highlight css %}
|
||
|
|
||
|
#container {
|
||
|
/* either of these will work for horizontal Isotope layouts */
|
||
|
height: 80%;
|
||
|
height: 480px;
|
||
|
}
|
||
|
|
||
|
{% endhighlight %}
|
||
|
|
||
14 years ago
|
## cellsByColumn
|
||
14 years ago
|
|
||
13 years ago
|
A **horizontal** grid layout where items are centered inside each cell. The grid is defined by two options, `columnWidth` and `rowHeight`. The horizontal equivalent of cellsByRow.
|
||
14 years ago
|
|
||
14 years ago
|
### Options {#cellsByColumn-options}
|
||
14 years ago
|
|
||
|
<dl class="clearfix">
|
||
|
<dt><code>columnWidth</code></dt>
|
||
|
<dd class="option-type">Integer</dd>
|
||
|
</dl>
|
||
14 years ago
|
<dl class="clearfix">
|
||
|
<dt><code>rowHeight</code></dt>
|
||
|
<dd class="option-type">Integer</dd>
|
||
|
</dl>
|
||
14 years ago
|
|
||
14 years ago
|
### Example {#cellsByColumn-example}
|
||
14 years ago
|
|
||
|
{% highlight javascript %}
|
||
|
|
||
|
$('#container').isotope({
|
||
13 years ago
|
layoutMode: 'cellsByColumn',
|
||
12 years ago
|
cellsByColumn: {
|
||
13 years ago
|
columnWidth: 240,
|
||
|
rowHeight: 360
|
||
14 years ago
|
}
|
||
|
});
|
||
|
|
||
|
{% endhighlight %}
|
||
|
|
||
|
|
||
14 years ago
|
## cellsByRow
|
||
14 years ago
|
|
||
13 years ago
|
A **vertical** grid layout where items are centered inside each cell. The grid is defined by two options, `columnWidth` and `rowHeight`.
|
||
14 years ago
|
|
||
14 years ago
|
### Options {#cellsByRow-options}
|
||
14 years ago
|
|
||
|
<dl class="clearfix">
|
||
|
<dt><code>columnWidth</code></dt>
|
||
|
<dd class="option-type">Integer</dd>
|
||
|
</dl>
|
||
|
<dl class="clearfix">
|
||
|
<dt><code>rowHeight</code></dt>
|
||
|
<dd class="option-type">Integer</dd>
|
||
|
</dl>
|
||
|
|
||
14 years ago
|
### Example {#cellsByRow-example}
|
||
14 years ago
|
|
||
|
{% highlight javascript %}
|
||
|
|
||
|
$('#container').isotope({
|
||
13 years ago
|
layoutMode: 'cellsByRow',
|
||
|
cellsByRow: {
|
||
|
columnWidth: 240,
|
||
|
rowHeight: 360
|
||
14 years ago
|
}
|
||
|
});
|
||
|
|
||
|
{% endhighlight %}
|
||
|
|
||
14 years ago
|
## fitColumns
|
||
14 years ago
|
|
||
13 years ago
|
Item elements are arranged into columns. Columns progress **horizontally** from left to right. Items within those columns are arranged top-to-bottom. The horizontal equivalent of fitRows.
|
||
14 years ago
|
|
||
14 years ago
|
## fitRows
|
||
|
|
||
13 years ago
|
Item elements are arranged into rows. Rows progress **vertically** top to bottom. Similar to what you would expect from a layout that uses `float: left`.
|
||
14 years ago
|
|
||
|
## masonry
|
||
|
|
||
13 years ago
|
Masonry is the default layout mode for Isotope. Item elements are arranged intelligently within a **vertical** grid. For each item element, the script calculates the next best fit for the item within the grid.
|
||
14 years ago
|
|
||
|
### Options {#masonry-options}
|
||
14 years ago
|
|
||
|
<dl class="clearfix">
|
||
14 years ago
|
<dt><code>columnWidth</code></dt>
|
||
14 years ago
|
<dd class="option-type">Integer</dd>
|
||
|
</dl>
|
||
|
|
||
14 years ago
|
The width of one column in the grid. If no value is set for `columnWidth`, default is the width of the first item element.
|
||
14 years ago
|
|
||
14 years ago
|
### Example {#masonry-example}
|
||
14 years ago
|
|
||
|
{% highlight javascript %}
|
||
|
|
||
|
$('#container').isotope({
|
||
13 years ago
|
masonry: {
|
||
|
columnWidth: 240
|
||
14 years ago
|
}
|
||
|
});
|
||
|
|
||
|
{% endhighlight %}
|
||
|
|
||
|
|
||
14 years ago
|
## masonryHorizontal
|
||
|
|
||
13 years ago
|
The **horizontal** equivalent of masonry layout. Instead of progressing top-to-bottom, masonryHorizontal layout will progress left-to-right. Item elements are arranged intelligently within a grid. For each item element, the script calculates the next best fit for the item within the grid.
|
||
14 years ago
|
|
||
|
### Options {#masonryHorizontal-options}
|
||
|
|
||
14 years ago
|
<dl class="clearfix">
|
||
|
<dt><code>rowHeight</code></dt>
|
||
|
<dd class="option-type">Integer</dd>
|
||
|
</dl>
|
||
|
|
||
14 years ago
|
The width of one column in the grid. If no value is set for `rowHeight`, default is the height of the first item element.
|
||
|
|
||
|
### Example {#masonryHorizontal-example}
|
||
14 years ago
|
|
||
|
{% highlight javascript %}
|
||
|
|
||
|
$('#container').isotope({
|
||
13 years ago
|
masonryHorizontal: {
|
||
|
rowHeight: 360
|
||
14 years ago
|
}
|
||
|
});
|
||
|
|
||
|
{% endhighlight %}
|
||
14 years ago
|
|
||
14 years ago
|
## straightAcross
|
||
|
|
||
13 years ago
|
Item elements are arranged **horizontally** left to right. Useful for simple lists.
|
||
14 years ago
|
|
||
14 years ago
|
## straightDown
|
||
|
|
||
13 years ago
|
Item elements are arranged **vertically** top to bottom. Useful for simple lists.
|
||
13 years ago
|
|
||
|
## Modified layout modes
|
||
|
|
||
|
[Isotope's methods can be extended and overwritten](extending-isotope.html) to shim-in additional functionality. See these modified layout modes:
|
||
|
|
||
|
+ [**Centered masonry**](../custom-layout-modes/centered-masonry.html)
|
||
|
+ [**Masonry corner stamp**](../custom-layout-modes/masonry-corner-stamp.html)
|
||
|
+ [**Masonry gutters**](../custom-layout-modes/masonry-gutters.html)
|
||
|
|
||
|
To use these mods, copy the revised methods found in the demos' page source. They look like:
|
||
|
|
||
|
{% highlight javascript %}
|
||
|
|
||
|
$.Isotope.prototype._masonryReset = function() {
|
||
|
// modified code..
|
||
|
};
|
||
|
|
||
|
{% endhighlight %}
|