Browse Source

fix cellsByRow container size

pull/563/head
David DeSandro 12 years ago
parent
commit
e68f99c754
  1. 6
      examples/filter-sort.html
  2. 5
      layout-modes/cells-by-row.js

6
examples/filter-sort.html

@ -154,6 +154,8 @@
<script src="../layout-mode.js"></script> <script src="../layout-mode.js"></script>
<script src="../isotope.js"></script> <script src="../isotope.js"></script>
<script src="../layout-modes/fit-rows.js"></script> <script src="../layout-modes/fit-rows.js"></script>
<script src="../layout-modes/cells-by-row.js"></script>
<script src="../layout-modes/vertical.js"></script>
<script> <script>
docReady( function() { docReady( function() {
@ -161,6 +163,10 @@ docReady( function() {
var iso = window.iso = new Isotope( container, { var iso = window.iso = new Isotope( container, {
layoutMode: 'fitRows', layoutMode: 'fitRows',
transitionDuration: '0.8s', transitionDuration: '0.8s',
cellsByRow: {
columnWidth: 130,
rowHeight: 140,
},
getSortData: { getSortData: {
number: '.number parseInt', number: '.number parseInt',
symbol: '.symbol', symbol: '.symbol',

5
layout-modes/cells-by-row.js

@ -29,10 +29,9 @@ function cellsByRowDefinition( layoutMode, getSize ) {
// or size of container // or size of container
containerSize.innerHeight; containerSize.innerHeight;
} }
// set cols
this.cols = Math.floor( containerSize.innerWidth / this.columnWidth ); this.cols = Math.floor( containerSize.innerWidth / this.columnWidth );
this.cols = Math.max( this.cols, 1 ); this.cols = Math.max( this.cols, 1 );
}; };
CellsByRow.prototype._getItemLayoutPosition = function( item ) { CellsByRow.prototype._getItemLayoutPosition = function( item ) {
@ -48,7 +47,7 @@ function cellsByRowDefinition( layoutMode, getSize ) {
CellsByRow.prototype._getContainerSize = function() { CellsByRow.prototype._getContainerSize = function() {
return { return {
height: ( this.itemIndex / this.cols ) * this.rowHeight height: Math.ceil( this.itemIndex / this.cols ) * this.rowHeight
}; };
}; };

Loading…
Cancel
Save