我只希望在4-5秒后调用OVER函数块,如果我将拖放的项保存几秒钟,那么OVER函数块需要b调用else,而不是。
$('.treeLink').droppable({
tolerance: 'pointer',
accept: '.childLinks',
over: function() {},
over: function() {
getTreeLinks($(this).attr('id').split("treeLink")[1]);
},
drop: function() {
updateGovLinks($(this).attr('id'));
}
});发布于 2012-11-28 06:37:18
您可能需要使用某种超时:
var timeout;
$('.treeLink').droppable({
tolerance: 'pointer',
accept: '.childLinks',
over: function() {
var self = this;
timeout = setTimeout(function () {
getTreeLinks($(self).attr('id').split("treeLink")[1])
}, 4000);
},
out: function () {
clearTimeout(timeout);
},
drop: function() {
updateGovLinks($(this).attr('id'));
}
});https://stackoverflow.com/questions/13599082
复制相似问题