Skip to content

Instantly share code, notes, and snippets.

@nucleardreamer
Created June 17, 2014 19:26
Show Gist options
  • Save nucleardreamer/bc3f737f8b0f9c15e3ba to your computer and use it in GitHub Desktop.
Save nucleardreamer/bc3f737f8b0f9c15e3ba to your computer and use it in GitHub Desktop.
(function(D) {
/**
* Constructor
*/
var VariableHeightLayoutManager = function(){}
// Shorthand prototype storage (might trim down code for many functions)
var fn = VariableHeightLayoutManager.prototype;
fn.numColumns = 6;
fn.childrenArray = [];
// Add grid listeners
fn.addListeners = function () {
// Make instance of "this" for use inside functions
var _self = this;
// Listen for a change in the body columns (triggered from Browser.js)
$(window).on('onBodyColumnsChanged', D.debounce(_self.onResize, 50));
};
// Build and update the grid on resize
fn.onResize = function () {
var _self = this;
_self.childrenArray = _.map(new Array(_self.numColumns), function(){ return 0 })
};
// Public Release to Dspn object
// -----------------------------
D.layoutManager = VariableHeightLayoutManager;
}(Dspn));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment