Testing Freewall.js
by Marcus Baptiste
HTML
<div id="container">
<div class="box box1"></div>
<div class="box box2"></div>
<div class="box box3"></div>
<div class="box box4"></div>
<div class="box box1"></div>
<div class="box box2"></div>
<div class="box box3"></div>
<div class="box box4"></div>
<div class="box box1"></div>
<div class="box box2"></div>
<div class="box box3"></div>
<div class="box box4"></div>
</div>
SCSS
#container {
width: 100%;
height: 100%;
}
.box {
display: inline-block;
position: relative;
}
.box1 {
width: 100px;
height: 100px;
background-color: #f00;
}
.box2 {
width: 200px;
height: 100px;
background-color: #00f;
}
.box3 {
width: 100px;
height: 200px;
background-color: #0f0;
}
.box4 {
width: 200px;
height: 200px;
background-color: #f0f;
}
JavaScript
// created by Minh Nguyen;
// version 1.05;
(function($) {
// for zeptojs;
$.isNumeric == null && ($.isNumeric = function(src) {
return src != null && src.constructor === Number;
});
$.isFunction == null && ($.isFunction = function(src) {
return src != null && src instanceof Function;
});
var $W = $(window);
var $D = $(document);
var layoutManager = {
// default setting;
defaultConfig: {
animate: false,
cellW: 100, // function(container) {return 100;}
cellH: 100, // function(container) {return 100;}
delay: 0, // slowdown active block;
engine: 'giot', // 'giot' is a person name;
fixSize: null, // resize + adjust = fill gap;
//fixSize: 0, resize but keep ratio = no fill gap;
//fixSize: 1, no resize + no adjust = no fill gap;
gutterX: 15, // width spacing between blocks;
gutterY: 15, // height spacing between blocks;
keepOrder: false,
selector: '> div',
draggable: false,
cacheSize: true, // caches the original size of block;
rightToLeft: false,
bottomToTop: false,
onGapFound: function() {},
onComplete: function() {},
onResize: function() {},
onBlockDrag: function() {},
onBlockMove: function() {},
onBlockDrop: function() {},
onBlockReady: function() {},
onBlockFinish: function() {},
onBlockActive: function() {},
onBlockResize: function() {}
},
plugin: {},
totalGrid: 1,
transition: false,
loadBlock: function(item, setting) {
var runtime = setting.runtime;
var gutterX = runtime.gutterX;
var gutterY = runtime.gutterY;
var cellH = runtime.cellH;
var cellW = runtime.cellW;
var block =...