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.03k stars 1.2k forks source link

add resize_widget_dimensions to change widget dimensions after gridster initialization #321

Closed hrosenbauer closed 10 years ago

hrosenbauer commented 10 years ago

(this pull request is based on the discussion of https://github.com/ducksboard/gridster.js/pull/77 and the code of https://gist.github.com/OwlyCode/6421823 with small changes, so most of the credits go to https://github.com/OwlyCode)

This will add resize_widget_dimensions() to gridster.js which allows to resize the widget dimensions after initialization:

// initialize gridster with 200x200px widgets using a 5px margin
var gridster = $('.gridster ul').gridster({
    widget_base_dimensions: [200, 200],
    widget_margins: [5, 5]
}).data('gridster');

// resize the widgets to 300x300px and 10px margin
gridster.resize_widget_dimensions({
    widget_base_dimensions: [300, 300],
    widget_margins: [10, 10]
});
adamyonk commented 10 years ago

This is super nice! Thanks for taking the time to do this, @rebugger. :+1:

Munter commented 9 years ago

Did you accidentally hit the close button instead of the merge button here?