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