Browse Source

move resizeVertical to LayoutMode

pull/563/head
David DeSandro 11 years ago
parent
commit
81a838e6d2
  1. 14
      isotope.js
  2. 14
      layout-mode.js
  3. 2
      layout-modes/cells-by-column.js
  4. 2
      layout-modes/fit-columns.js
  5. 2
      layout-modes/horizontal.js

14
isotope.js

@ -247,20 +247,6 @@ function isotopeDefinition( Outlayer, getSize, matchesSelector, Item, layoutMode
this._mode().resize();
};
// for vertical layout modes
Isotope.prototype.resizeVertical = function() {
// don't trigger if size did not change
var size = getSize( this.element );
// check that this.size and size are there
// IE8 triggers resize on body size change, so they might not be
var hasSizes = this.size && size;
if ( hasSizes && size.innerHeight === this.size.innerHeight ) {
return;
}
this.layout();
};
return Isotope;
}

14
layout-mode.js

@ -63,6 +63,20 @@ layoutMode.create = function( namespace, options ) {
this._outlayerMethod( 'resize', arguments );
};
// for horizontal layout modes, check vertical size
LayoutMode.prototype.resizeVertical = function() {
// don't trigger if size did not change
var size = getSize( this.isotope.element );
// check that this.size and size are there
// IE8 triggers resize on body size change, so they might not be
var hasSizes = this.isotope.size && size;
if ( hasSizes && size.innerHeight === this.isotope.size.innerHeight ) {
return;
}
this.isotope.layout();
};
// ----- measurements ----- //
LayoutMode.prototype.getColumnWidth = function() {

2
layout-modes/cells-by-column.js

@ -35,7 +35,7 @@ function cellsByColumnDefinition( layoutMode ) {
};
CellsByColumn.prototype.resize = function() {
this.isotope.resizeVertical();
this.resizeVertical();
};
return CellsByColumn;

2
layout-modes/fit-columns.js

@ -37,7 +37,7 @@ function fitColumnsDefinition( layoutMode ) {
};
FitColumns.prototype.resize = function() {
this.isotope.resizeVertical();
this.resizeVertical();
};
return FitColumns;

2
layout-modes/horizontal.js

@ -27,7 +27,7 @@ function horizontalDefinition( layoutMode ) {
};
Horizontal.prototype.resize = function() {
this.isotope.resizeVertical();
this.resizeVertical();
};
return Horizontal;

Loading…
Cancel
Save