简体   繁体   English

添加“删除”后,Gridster无法正常工作

[英]Gridster not working properly after adding “delete”

I am using gridster and have added delete function so that I can delete the box. 我正在使用gridster并添加了删除功能,以便可以删除该框。 Now when I delete any one of the box, the alignment is distorted and there is a blank space left out. 现在,当我删除其中一个框时,对齐方式将变形,并且留出了空白空间。 And also when I try to drag and drop the boxes to change their position, the boxes are overlapping.(Please refer image) 另外,当我尝试拖放框以更改其位置时,这些框是重叠的。(请参阅图片)

Every thing works fine if delete function is not applied. 如果未应用删除功能,则一切正常。

I have created a jsfiddle.net/NMF5n/5/ Jsfiddle 我创建了一个jsfiddle.net/NMF5n/5/ Jsfiddle

Please help. 请帮忙。

Thanks in advance. 提前致谢。

在此处输入图片说明在此处输入图片说明

Looking at Gridster website and demos http://gridster.net/#demos , I find a way to delete items: 查看Gridster网站和演示http://gridster.net/#demos ,我发现一种删除项目的方法:

gridster.remove_widget(... the item ...);

So using it in your sample: 因此,在示例中使用它:

$(".del_img").click(function(){
    gridster.remove_widget($(this).parent());
});

Where gridster is: 其中gridster是:

var gridster = $(".bla").gridster({
    widget_margins: [10, 10],
    widget_base_dimensions: [140, 140],
    widget_selector : "div",
    resize: {
        enabled: true
    }
}).data('gridster');

See fiddle updated: http://jsfiddle.net/NMF5n/7/ 请参阅更新的提琴: http : //jsfiddle.net/NMF5n/7/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM