mic*_*p78 5 javascript jquery gridster
使用Gridster,我们使用resize.enabledconfig选项创建了一个具有可调整大小的小部件的网格.
在用户完成调整Gridster小部件的大小后,我们希望获得小部件的新的最终大小.我们应该怎么做?
ne1*_*10s 12
我最近一直在使用gridster调整大小.这是我抓住尺寸的方式
$(function () { //DOM Ready
$scope.gridster = $(".gridster ul").gridster({
...
resize: {
enabled: true,
start: function (e, ui, $widget) {
...
},
stop: function (e, ui, $widget) {
var newHeight = this.resize_coords.data.height;
var newWidth = this.resize_coords.data.width;
...
}
},
...
}).data('gridster');
});
Run Code Online (Sandbox Code Playgroud)
可以在resize-stop事件中读取'newHeight'和'newWidth'.您还可以浏览"this"实例以获取单位大小而不是像素.