Filter & sort magical layouts http://isotope.metafizzy.co
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

60 lines
1.3 KiB

/*!
* Masonry layout mode
* sub-classes Masonry
* http://masonry.desandro.com
*/
( function( window ) {
'use strict';
// -------------------------- helpers -------------------------- //
// extend objects
function extend( a, b ) {
for ( var prop in b ) {
a[ prop ] = b[ prop ];
}
return a;
}
// -------------------------- masonryDefinition -------------------------- //
// used for AMD definition and requires
function masonryDefinition( LayoutMode, Masonry ) {
// create an Outlayer layout class
var MasonryMode = LayoutMode.create('masonry');
// save on to these methods
var _getElementOffset = MasonryMode.prototype._getElementOffset;
var layout = MasonryMode.prototype.layout;
// sub-class Masonry
extend( MasonryMode.prototype, Masonry.prototype );
// set back, as it was overwritten by Masonry
MasonryMode.prototype._getElementOffset = _getElementOffset;
MasonryMode.prototype.layout = layout;
return MasonryMode;
}
// -------------------------- transport -------------------------- //
if ( typeof define === 'function' && define.amd ) {
// AMD
define( [
11 years ago
'../js/layout-mode',
'masonry/masonry'
],
masonryDefinition );
} else {
// browser global
masonryDefinition(
window.Isotope.LayoutMode,
window.Masonry
);
}
})( window );