Coding
September 2, 2012 posted by Maan

Gridster.js: A jQuery Plugin for Building Intuitive Draggable Layouts

Gridster.js: A jQuery Plugin for Building Intuitive Draggable Layouts

This is it, the mythical drag-and-drop multi-column grid has arrived. Gridster is a jQuery plugin that allows building intuitive draggable layouts from elements spanning multiple columns. You can even dynamically add and remove elements from the grid. It is on par with sliced bread, or possibly better. MIT licensed. Suitable for children of all ages.

Setup

Include dependencies

Gridster is currently written as a jQuery plugin, so you need to include it in the head of the document. Download the latest release at jQuery.

jQuery Setup

<script type="text/javascript" src="libs/jquery.js"></script>
<script type="text/javascript" src="jquery.gridster.js"></script>

HTML Structure

Class names and tags are customizable, gridster only cares about data attributes. Use a structure like this:

HTML Structure

<div class="gridster">
  <ul>
        <li data-row="1" data-col="1" data-sizex="1" data-sizey="1"></li>
        <li data-row="2" data-col="1" data-sizex="1" data-sizey="1"></li>
        <li data-row="3" data-col="1" data-sizex="1" data-sizey="1"></li>
        <li data-row="1" data-col="2" data-sizex="2" data-sizey="1"></li>
        <li data-row="2" data-col="2" data-sizex="2" data-sizey="2"></li>
        <li data-row="1" data-col="4" data-sizex="1" data-sizey="1"></li>
        <li data-row="2" data-col="4" data-sizex="2" data-sizey="1"></li>
        <li data-row="3" data-col="4" data-sizex="1" data-sizey="1"></li>
        <li data-row="1" data-col="5" data-sizex="1" data-sizey="1"></li>
        <li data-row="3" data-col="5" data-sizex="1" data-sizey="1"></li>
       <li data-row="1" data-col="6" data-sizex="1" data-sizey="1"></li>
       <li data-row="2" data-col="6" data-sizex="1" data-sizey="2"></li>
   </ul>
</div>

Grid it up!

Gridster accepts one argument, a hash of with configuration options. See the documentation for details.

configuration options

$(<strong>function</strong>(){ <em>//DOM Ready</em>
    $(".gridster ul").gridster({
        widget_margins<strong>:</strong> [10, 10],
        widget_base_dimensions<strong>:</strong> [140, 140]
    });
});

Gridster supports:  Internet Explorer 9+, Firefox, Chrome, Safari and Opera.  

Documentation       Download Now

Maan

Hello!My name is Maan and I`m co-founder of downgraf And Just4Inspiration. who have many type of Graphic Content & Inspiration. You can Follow me on Twitter , Facebook & Google +

Related Posts

1 Comment

  • 1

    VERY COOL!!!

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>