Javascript jquery可拖动覆盖函数
我只想在4-5秒后调用OVER函数块 如果我按住拖动的项目几秒钟,则需要调用OVER功能块,否则不调用Javascript jquery可拖动覆盖函数,javascript,jquery-ui,jquery,jquery-plugins,Javascript,Jquery Ui,Jquery,Jquery Plugins,我只想在4-5秒后调用OVER函数块 如果我按住拖动的项目几秒钟,则需要调用OVER功能块,否则不调用 $('.treeLink').droppable({ tolerance: 'pointer', accept: '.childLinks', over: function() {}, over: function() { getTreeLinks($(this).attr('id').split("treeLink")[1]); },
$('.treeLink').droppable({
tolerance: 'pointer',
accept: '.childLinks',
over: function() {},
over: function() {
getTreeLinks($(this).attr('id').split("treeLink")[1]);
},
drop: function() {
updateGovLinks($(this).attr('id'));
}
});
您可能需要使用某种类型的超时:
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'));
}
});
您可能需要使用某种类型的超时:
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'));
}
});