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

Gridster.js add_widget hangs at page load #601

Open Priyankasurya opened 5 years ago

Priyankasurya commented 5 years ago

I'm using Gridster ( v0.7.0 - 2017-03-27 ) for my web site, and i need to add lot of widgets with "add_widget" command. While adding multiple gridster instances on the same page, page loads forever or hang during page load. Tested it on both Chrome & Firefox browser and issue exits.

Tried the solution provided here: https://github.com/ducksboard/gridster.js/issues/166 But it does't work.

Any ideas how to fix this problem?

Here's my code:

var gridster = [];

for(i=0; i<=5 ; i++){ gridster[i]=$(".gridster ul.grid"+i).gridster({ widget_base_dimensions: [5, 5], widget_margins: [5, 5], shift_widgets_up: false,
shift_larger_widgets_down: false, collision: { wait_for_mouseup: true }, avoid_overlapped_widgets: true
}).data('gridster');

$.each(widgets[i], function (j, widget) {
     gridster[i].add_widget.apply(gridster[i], widget)   
});       

}