gridster demo

prototype for Heavy Meta layout manager using gridster.js

HTML

<script src="http://code.jquery.com/ui/1.9.0/jquery-ui.js"></script>
<link rel="stylesheet" href="http://code.jquery.com/ui/1.9.0/themes/base/jquery-ui.css">
<script src="https://rawgithub.com/ducksboard/gridster.js/master/dist/jquery.gridster.js"></script>
    <div class="gridster">
        <ul id="reszable">
             
            <li data-row="3" data-col="1" data-sizex="1" data-sizey="1"><a href="http://google.com" target="_blank">LINK</a></li>
            <li data-row="1" data-col="2" data-sizex="2" data-sizey="1"></li>
             
        </ul>
    </div>

CSS

input {
    width: 100px;
}
a {
    display: block;
    position: relative;
    width: 100%;
    height: 100%;
}
.handle {
    border-bottom: 1px solid black;
    background-color: yellow
}
.gridster {
    position:relative;
    background-color: gray;
} 

li {
    background-color: white;
    width: 150px;
    height: 300px;
    border: solid 2px black;
}

.gridster > * {
    margin: 0 auto;
    -webkit-transition: height .4s;
    -moz-transition: height .4s;
    -o-transition: height .4s;
    -ms-transition: height .4s;
    transition: height .4s;
}

.gridster .gs_w{
    z-index: 2;
    position: absolute;
}

.ready .gs_w:not(.preview-holder) {
    -webkit-transition: opacity .3s, left .3s, top .3s;
    -moz-transition: opacity .3s, left .3s, top .3s;
    -o-transition: opacity .3s, left .3s, top .3s;
    transition: opacity .3s, left .3s, top .3s;
}

.ready .gs_w:not(.preview-holder) {
    -webkit-transition: opacity .3s, left .3s, top .3s, width .3s, height .3s;
    -moz-transition: opacity .3s, left .3s, top .3s, width .3s, height .3s;
    -o-transition: opacity .3s, left .3s, top .3s, width .3s, height .3s;
    transition: opacity .3s, left .3s, top .3s, width .3s, height .3s;
}

.gridster .preview-holder {
    z-index: 1;
    position: absolute;
    background-color: #fff;
    border-color: #fff;
    opacity: 0.3;
}

.gridster .player-revert {
    z-index: 10!important;
    -webkit-transition: left .3s, top .3s!important;
    -moz-transition: left .3s, top .3s!important;
    -o-transition: left .3s, top .3s!important;
    transition:  left .3s, top .3s!important;
}

.gridster .dragging {
    z-index: 10!important;
    -webkit-transition: all 0s !important;
    -moz-transition: all 0s !important;
    -o-transition: all 0s !important;
    transition: all 0s !important;
}

/* Uncomment this if you set helper : "clone" in draggable options */
/*.gridster .player {
  opacity:0;
}*/

JavaScript

$(function(){ //DOM Ready
    
        $(".gridster ul").on({
            mousedown: function(e) {
                $(this).data({top: e.pageX, left: e.pageY});
            },
            mouseup: function(e) {
                var top   = e.pageX,
                    left  = e.pageY,
                    ptop  = $(this).data('top'),
                    pleft = $(this).data('left');
                
                $(this).data('dragged', Math.abs(top - ptop) > 15 || Math.abs(left - pleft) > 15);
            },
            click: function(e) {
                if ( $(this).data('dragged') ) e.preventDefault();
            }
        }, 'a');
        
        var gridster = $(".gridster ul").gridster().data('gridster');
        
    });