Browse Source

js : use $.Molequul, add in _rows layout

pull/14/head
David DeSandro 14 years ago
parent
commit
92fdd04e4f
  1. 32
      src/jquery.molequul.js
  2. 2
      src/jquery.ui.widget.js

32
src/jquery.molequul.js

@ -5,14 +5,14 @@
(function( $, undefined ) { (function( $, undefined ) {
// our "Widget" object constructor // our "Widget" object constructor
window.Molequul = function( options, element ){ $.Molequul = function( options, element ){
this.element = $( element ); this.element = $( element );
this._create( options ); this._create( options );
this._init(); this._init();
}; };
Molequul.prototype = { $.Molequul.prototype = {
options : { options : {
columnWidth : 150, columnWidth : 150,
@ -425,7 +425,7 @@
// ====================== Masonry ====================== // ====================== Masonry ======================
Molequul.prototype._masonryPlaceBrick = function( $brick, setCount, setY ) { $.Molequul.prototype._masonryPlaceBrick = function( $brick, setCount, setY ) {
// here, `this` refers to a child element or "brick" // here, `this` refers to a child element or "brick"
// get the minimum Y value from the columns // get the minimum Y value from the columns
var minimumY = Math.min.apply( Math, setY ), var minimumY = Math.min.apply( Math, setY ),
@ -454,7 +454,7 @@
}; };
Molequul.prototype._masonryLayout = function( $elems ) { $.Molequul.prototype._masonryLayout = function( $elems ) {
var instance = this; var instance = this;
$elems.each(function(){ $elems.each(function(){
var $this = $(this), var $this = $(this),
@ -485,7 +485,7 @@
}); });
}; };
Molequul.prototype._masonryGetColCount = function( ) { $.Molequul.prototype._masonryGetColCount = function( ) {
// console.log( 'getting masonry col count') // console.log( 'getting masonry col count')
this.colW = this.options.columnWidth || this.$allAtoms.outerWidth(true); this.colW = this.options.columnWidth || this.$allAtoms.outerWidth(true);
@ -501,7 +501,7 @@
}; };
// reset // reset
Molequul.prototype._masonryReset = function() { $.Molequul.prototype._masonryReset = function() {
// FIXME shouldn't have to call this again // FIXME shouldn't have to call this again
this._masonryGetColCount(); this._masonryGetColCount();
var i = this.colCount; var i = this.colCount;
@ -514,7 +514,7 @@
Molequul.prototype._masonryResize = function() { $.Molequul.prototype._masonryResize = function() {
var prevColCount = this.colCount; var prevColCount = this.colCount;
// get updated colCount // get updated colCount
this._masonryGetColCount(); this._masonryGetColCount();
@ -526,7 +526,7 @@
return this; return this;
}; };
Molequul.prototype._masonryGetContainerSize = function() { $.Molequul.prototype._masonryGetContainerSize = function() {
var containerHeight = Math.max.apply( Math, this.colYs ) - this.posTop; var containerHeight = Math.max.apply( Math, this.colYs ) - this.posTop;
return { height: containerHeight }; return { height: containerHeight };
}; };
@ -534,7 +534,7 @@
// ====================== rows ====================== // ====================== rows ======================
_rowsLayout : function( $elems ) { $.Molequul.prototype._rowsLayout = function( $elems ) {
var instance = this; var instance = this;
return $elems.each( function() { return $elems.each( function() {
var $this = $(this), var $this = $(this),
@ -557,25 +557,25 @@
instance.clearFloat.x += atomW; instance.clearFloat.x += atomW;
}); });
}, };
_rowsReset : function() { $.Molequul.prototype._rowsReset = function() {
this.clearFloat = { this.clearFloat = {
x : 0, x : 0,
y : 0, y : 0,
height : 0 height : 0
}; };
return this; return this;
}, };
_rowsGetContainerSize : function () { $.Molequul.prototype._rowsGetContainerSize = function () {
return { height : this.clearFloat.height }; return { height : this.clearFloat.height };
}, };
_rowsResize : function() { $.Molequul.prototype._rowsResize = function() {
this.width = this.element.width(); this.width = this.element.width();
return this.reLayout() return this.reLayout()
}, };

2
src/jquery.ui.widget.js vendored

@ -59,6 +59,6 @@
}; };
$.widget.bridge( 'molequul', Molequul ); $.widget.bridge( 'molequul', $.Molequul );
})( jQuery ); })( jQuery );

Loading…
Cancel
Save