Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/jquery-ui/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript jquery可拖动覆盖函数_Javascript_Jquery Ui_Jquery_Jquery Plugins - Fatal编程技术网

Javascript jquery可拖动覆盖函数

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]); },

我只想在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'));
    }
});

您可能需要使用某种类型的超时:

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'));
    }
});