How to add custom method in gridster.js?

188 Views Asked by At

I am using Gridster Library .It provides its method like add_widget,Remove_widget,resize,Draggable etc I want to Create my own method in its JS file and use it

for E.G

Script file

$(function(){$(".gridster ul").gridster({
        widget_margins: [10, 10],
        widget_base_dimensions: [140, 140],
        animate: true,
       Custom_Method:{enable:true}
    })
}).data('gridster');

Some what like the example is shown for my custom_method

1

There are 1 best solutions below

0
On
$(function(){$(".gridster ul").gridster({
    widget_margins: [10, 10],
    widget_base_dimensions: [140, 140],
    animate: true,
   customMethod:function(){enable:true} //Your custom method
})

}).data('gridster');

//To access

$(".gridster ul").gridster().data('gridster').options.customMethod()