0
我对一些可拖动的项目使用gridster gridster.net。这些项目也是可点击的。当点击时,它会展开。但问题是,当我拖动一个项目时,它也会触发一个单击事件,并且该项目在放下后展开。我怎样才能防止呢?使用jquery gridster阻止点击事件
这里是我的jQuery代码示例:
$(document).on('click touchend', '.gridster li.gs-closed p', function() {
var clickedItem = $(this);
var parent = clickedItem.parent('li');
gridster.resize_widget(parent, 1,4);
parent.removeClass('gs-closed').addClass('gs-opened');
});
$(document).on('dblclick touchend', '.gridster li.gs-opened p', function() {
var clickedItem = $(this);
var parent = clickedItem.parent('li');
gridster.resize_widget(parent, 1, 1);
parent.removeClass('gs-opened').addClass('gs-closed');
});
[gridster的可能重复,不要调用div的点击操作](http:// stackover flow.com/questions/14301026/gridster-do-not-invoke-the-click-action-for-the-div) –