$(function(){ $('#container').masonry({ // 親要素を指定 itemSelector: '.box', // 子要素を指定 columnWidth: 200, // 子要素の最小幅 fitWidth: true, // 親要素の幅サイズが可変する originLeft: false, // falseで子要素の並びが逆順になる gutter: 30, // 子要素の間にマージンを設定 containerStyle: { position: 'relative' }, // 親要素にスタイルを追加できる resize: true // ウィンドウサイズが変更された時に並び替え }); });