我只想在4-5秒后调用OVER功能块 我保持拖动项目几秒钟然后OVER功能块需要调用否则
$('.treeLink').droppable({
tolerance: 'pointer',
accept: '.childLinks',
over: function() {},
over: function() {
getTreeLinks($(this).attr('id').split("treeLink")[1]);
},
drop: function() {
updateGovLinks($(this).attr('id'));
}
});
答案 0 :(得分:1)
你可能想要使用某种超时:
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'));
}
});