ducksboard / gridster.js

gridster.js is a jQuery plugin that makes building intuitive draggable layouts from elements spanning multiple columns
http://gridster.net/
MIT License
6.04k stars 1.2k forks source link

Dimensions are wrong at w=400, h=225 - help! #472

Closed stodge closed 9 years ago

stodge commented 9 years ago

I am following the example code so I have:

    $(".gridster ul").gridster({
        widget_margins: [10, 10],
        widget_base_dimensions: [140, 140],
        min_cols: 6,
        draggable: {
            handle: '.gadget-header'
        }
    });

When I create the gridster object using the following template, the dimensions are wrong:

< li data-row="1" data-col="1" data-sizex="1" data-sizey="1" class="gs-w"></ li>

The demo shows that the width should be 140px and the height should be 140px, but mine has w=400px and h=225px. Somehow the 140x140 is being overridden in CSS but I have no idea how or by what. The browser's dev tools don't show me what CSS file (if any) is the culprit.

Any ideas appreciated!

stodge commented 9 years ago

It was a silly mistake on my part. I was trying to retrieve the gridster object from the wrong element. I changed it to the code from the demo and it works now:

this.gridster = $(".gridster ul").gridster().data('gridster');