Browse Source

use needsResizeLayout in Outlayer v1.2

pull/726/head
David DeSandro 11 years ago
parent
commit
9b845ca629
  1. 4
      bower.json
  2. 4
      js/isotope.js
  3. 10
      js/layout-mode.js

4
bower.json

@ -13,8 +13,8 @@
"dependencies": { "dependencies": {
"get-size": "desandro/get-size#>=1 <2", "get-size": "desandro/get-size#>=1 <2",
"matches-selector": "desandro/matches-selector#>=1 <2", "matches-selector": "desandro/matches-selector#>=1 <2",
"outlayer": ">=1.1.10 <2", "outlayer": "v1.2",
"masonry": ">=3.1 <4" "masonry": "3.1.x"
}, },
"devDependencies": { "devDependencies": {
"doc-ready": "desandro/doc-ready", "doc-ready": "desandro/doc-ready",

4
js/isotope.js

@ -436,8 +436,8 @@ function isotopeDefinition( Outlayer, getSize, matchesSelector, Item, LayoutMode
return this._mode()._getContainerSize(); return this._mode()._getContainerSize();
}; };
Isotope.prototype.resize = function() { Isotope.prototype.needsResizeLayout = function() {
this._mode().resize(); return this._mode().needsResizeLayout();
}; };
// -------------------------- adding & removing -------------------------- // // -------------------------- adding & removing -------------------------- //

10
js/layout-mode.js

@ -29,7 +29,7 @@ function layoutModeDefinition( getSize, Outlayer ) {
'_manageStamp', '_manageStamp',
'_getContainerSize', '_getContainerSize',
'_getElementOffset', '_getElementOffset',
'resize' 'needsResizeLayout'
]; ];
for ( var i=0, len = facadeMethods.length; i < len; i++ ) { for ( var i=0, len = facadeMethods.length; i < len; i++ ) {
@ -47,17 +47,13 @@ function layoutModeDefinition( getSize, Outlayer ) {
// ----- ----- // // ----- ----- //
// for horizontal layout modes, check vertical size // for horizontal layout modes, check vertical size
LayoutMode.prototype.resizeVertical = function() { LayoutMode.prototype.needsVerticalResizeLayout = function() {
// don't trigger if size did not change // don't trigger if size did not change
var size = getSize( this.isotope.element ); var size = getSize( this.isotope.element );
// check that this.size and size are there // check that this.size and size are there
// IE8 triggers resize on body size change, so they might not be // IE8 triggers resize on body size change, so they might not be
var hasSizes = this.isotope.size && size; var hasSizes = this.isotope.size && size;
if ( hasSizes && size.innerHeight === this.isotope.size.innerHeight ) { return hasSizes && size.innerHeight !== this.isotope.size.innerHeight;
return;
}
this.isotope.layout();
}; };
// ----- measurements ----- // // ----- measurements ----- //

Loading…
Cancel
Save