Masonry is a JavaScript grid layout library. It works by placing elements in optimal position based on available vertical space, sort of like a mason fitting stones in a wall. You've probably seen it in use all over the Internet.
.masonry()
method
to the wrapping container element in your jQuery script. Depending on the layout,
you’ll most likely need to specify one option.
For layouts with elements that span multiple widths:
$('#wrapper').masonry({ columnWidth: 200 });
jqMasonry
will be processed by this plugin. Options can be specified
using HTML5 data attributes.
<div class="jqMasonry" data-item-selector=".grid-item"> <div class="grid-item">...</div> <div class="grid-item">...</div> <div class="grid-item">...</div> ... </div>
All options are optional, but columnWidth and itemSelector are recommended.
columnWidth: 240
itemSelector: '.grid-item'
gutter: 0
percentPosition: false
true
integer values in columnWidth
and gutter
will be in percentage instead of in pixel
stamp: 'item selector'
isFitWidth: false
isOriginLeft: true
isOriginLeft: true
. Set isOriginLeft: false
for right-to-left layouts.
isOriginTop: true
isOriginTop: true
. Set isOriginTop: false
for bottom-up layouts. It's like Tetris!
containerStyle: {position:relative}
null
to disable any css
transitionDuration: '0.4s'
Duration of the transition when items change position or appearance, set in a CSS time format.
isResizeBound: true
isInitLayout: true