gridie v0.1.6
gridie.js
gridie.js helps you building dynamic draggable/resizable layouts quickly. It's a standalone library inspired in gridstack.js and packery. It features multiple columns, non-fixed items height, mobile support and a quite small size (~6kb minified).
Install
Just include gridie.js and gridie.css between your stuff and you're ready to go.
Gridie is also available as an npm module you can use along with browserify. Just $ npm install gridie it.
Usage
All you need is a container element with a series of similar item elements, like:
<div id="container">
<div class="cell" data-x="0">Item 1</div>
<div class="cell" data-x="1">Item 2</div>
<div class="cell" data-x="2">Item 3</div>
</div>The minimal data each item needs is a data-x attribute, representing a column.
Item attributes
data-xitem's horizontal position. This represents a column number. Requireddata-yitem's vertical position in pixels. If not set, elements are stacked in orderdata-widthitem's width in columns (ie. not pixels). Defaults to1
Then you can initialize the layout passing the container element, and an optional settings object:
var g = new Gridie(document.getElementById('container'), {
columns: 6,
selector: '.cell',
resize: true,
drag: true
});Options
columnsamount of columns, defaults to 6selectoritems selector, defaults to'.cell'resizewhether items could be resized or not. Could be false, true or a settings object. Defaults totruehandlerselector for a resize handler element
dragwhether items could be dragged or not. Could be false, true or a settings object. Defaults totruehandlerselector for a drag handler element
initwhether the layout should be rendered immediately or not. Defaults totrue
License
Released under the MIT License
Copyright (c) 2016 Nicolás Arias