gridstack.js is a jQuery plugin for widget layout. This is drag-and-drop multi-column grid. It allows you to build draggable responsive bootstrap v3 friendly layouts. It also works great with knockout.js, angular.js and touch devices.
Inspired by gridster.js. Built with love.
Join gridstack.js on Slack: https://gridstackjs.troolee.com
Table of Contents generated with DocToc
- Demo
- Usage
- Requirements
- Install
- Basic usage
- Migrating to v0.2.5
- API Documentation
- Questions and Answers
- Touch devices support
- Use with knockout.js
- Use with angular.js
- Rails integration
- Change grid width
- Extra CSS
- Save grid to array
- Load grid from array
- Override resizable/draggable options
- IE8 support
- Use with require.js
- Nested grids
- Resizing active grid
- Using AniJS
- The Team
- Changes - v0.2.5 (2016-03-02) - v0.2.4 (2016-02-15) - v0.2.3 (2015-06-23) - v0.2.2 (2014-12-23) - v0.2.1 (2014-12-09) - v0.2.0 (2014-11-30) - v0.1.0 (2014-11-18)
- License
Please visit http://troolee.github.io/gridstack.js/ for demo. Or check out these example.
- lodash.js (>= 3.5.0, full build)
- jQuery (>= 1.11.0)
- jQuery UI (>= 1.11.0). Minimum required components: Core, Widget, Mouse, Draggable, Resizable
- (Optional) jquery-ui-touch-punch for touch-based devices support
Note: You can still use underscore.js (>= 1.7.0) instead of lodash.js
- Using CDN:
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/gridstack.js/0.2.5/gridstack.min.css" />
<script type="text/javascript" src='//cdnjs.cloudflare.com/ajax/libs/gridstack.js/0.2.5/gridstack.min.js'></script>
- Using bower:
$ bower install gridstack
- Using npm:
$ npm install gridstack
You can download files from dist
directory as well.
<div class="grid-stack">
<div class="grid-stack-item"
data-gs-x="0" data-gs-y="0"
data-gs-width="4" data-gs-height="2">
<div class="grid-stack-item-content"></div>
</div>
<div class="grid-stack-item"
data-gs-x="4" data-gs-y="0"
data-gs-width="4" data-gs-height="4">
<div class="grid-stack-item-content"></div>
</div>
</div>
<script type="text/javascript">
$(function () {
var options = {
cellHeight: 80,
verticalMargin: 10
};
$('.grid-stack').gridstack(options);
});
</script>
As of v0.2.5 all methods and parameters are in camel case to respect JavaScript Style Guide and Coding Conventions. All old methods and parameters are marked as deprecated and still available but a warning will be displayed in js console. They will be available until v1.0 when they will be completely removed.
Please check out doc/README.md
for more information about gridstack.js API.
Please feel free to as a questions here in issues, using Stackoverflow or Slack chat. We will glad to answer and help you as soon as we can.
Also please check our FAQ doc/FAQ.md
before asking in case the answer is already there.