Browse Source

js : use $.extend methods for masonry & clearFloat layouts

pull/14/head
David DeSandro 14 years ago
parent
commit
8f1c60f622
  1. 41
      src/jquery.ionize.js

41
src/jquery.ionize.js

@ -477,7 +477,9 @@
// ====================== Masonry ======================
$.Ionizer.prototype._masonryPlaceBrick = function( $brick, setCount, setY ) {
$.extend( $.Ionizer.prototype, {
_masonryPlaceBrick : function( $brick, setCount, setY ) {
// here, `this` refers to a child element or "brick"
// get the minimum Y value from the columns
var minimumY = Math.min.apply( Math, setY ),
@ -503,10 +505,10 @@
this.masonry.colYs[ shortCol + i ] = setHeight;
}
};
},
$.Ionizer.prototype._masonryLayout = function( $elems ) {
_masonryLayout : function( $elems ) {
var instance = this;
$elems.each(function(){
var $this = $(this),
@ -538,7 +540,7 @@
};
// reset
$.Ionizer.prototype._masonryReset = function() {
_masonryReset : function() {
// layout-specific props
this.masonry = {};
// FIXME shouldn't have to call this again
@ -549,11 +551,11 @@
this.masonry.colYs.push( this.posTop );
}
return this;
};
},
$.Ionizer.prototype._masonryResize = function() {
_masonryResize : function() {
var prevColCount = this.masonry.cols;
// get updated colCount
this._getSegments('masonry');
@ -563,17 +565,20 @@
}
return this;
};
},
$.Ionizer.prototype._masonryGetContainerSize = function() {
_masonryGetContainerSize : function() {
var containerHeight = Math.max.apply( Math, this.masonry.colYs ) - this.posTop;
return { height: containerHeight };
};
}
});
// ====================== clearFloat ======================
$.Ionizer.prototype._clearFloatLayout = function( $elems ) {
$.extend( $.Ionizer.prototype, {
_clearFloatLayout : function( $elems ) {
var instance = this;
return $elems.each( function() {
var $this = $(this),
@ -596,25 +601,27 @@
instance.clearFloat.x += atomW;
});
};
},
$.Ionizer.prototype._clearFloatReset = function() {
_clearFloatReset : function() {
this.clearFloat = {
x : 0,
y : 0,
height : 0
};
return this;
};
},
$.Ionizer.prototype._clearFloatGetContainerSize = function () {
_clearFloatGetContainerSize : function () {
return { height : this.clearFloat.height };
};
},
$.Ionizer.prototype._clearFloatResize = function() {
_clearFloatResize : function() {
this.width = this.element.width();
return this.reLayout()
};
}
});
// ====================== cellsByRow ======================

Loading…
Cancel
Save