如何在网格.js中添加自定义方法



我正在使用网格库。它提供了add_widget,Remove_widget,调整大小,可拖动等方法我想在其JS文件中创建自己的方法并使用它

例如

脚本文件

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

为我的custom_method显示了一些类似示例的内容

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

}).data('gridster');

访问

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

最新更新