Browse Source

simply to Isotope.createLayoutMode

pull/563/head
David DeSandro 12 years ago
parent
commit
f08077849f
  1. 26
      layout-mode.js
  2. 2
      layout-modes/fit-rows.js

26
layout-mode.js

@ -6,28 +6,18 @@
var Isotope = window.Isotope; var Isotope = window.Isotope;
function LayoutMode( isotope ) { Isotope.createLayoutMode = function( namespace, options ) {
this.isotope = isotope; function LayoutMode( isotope ) {
// link options to isotope.options this.isotope = isotope;
this.options = isotope && isotope.options[ this.namespace ]; // link options to isotope.options
} this.options = isotope && isotope.options[ this.namespace ];
// -------------------------- create -------------------------- //
LayoutMode.create = function( namespace, options ) {
// subclass LayoutMode
function Mode() {
LayoutMode.apply( this, arguments );
} }
Mode.prototype = new LayoutMode(); LayoutMode.prototype.namespace = namespace;
Mode.prototype.namespace = namespace;
// set default options // set default options
Isotope.prototype.options[ namespace ] = options || {}; Isotope.prototype.options[ namespace ] = options || {};
// register in Isotope // register in Isotope
Isotope.layoutModes[ namespace ] = Mode; Isotope.layoutModes[ namespace ] = LayoutMode;
return Mode; return LayoutMode;
}; };
Isotope.LayoutMode = LayoutMode;
})( window ); })( window );

2
layout-modes/fit-rows.js

@ -4,7 +4,7 @@
var Isotope = window.Isotope; var Isotope = window.Isotope;
var Outlayer = window.Outlayer; var Outlayer = window.Outlayer;
var FitRows = Isotope.LayoutMode.create( 'fitRows', { var FitRows = Isotope.createLayoutMode( 'fitRows', {
foo: 'bar' foo: 'bar'
}); });

Loading…
Cancel
Save