2012-11-28 2 views
1

동안 난 그냥 4-5초 혹이 난 후 OVER 기능 블록은하지JQuery와 기능

$('.treeLink').droppable({ 
    tolerance: 'pointer', 
    accept: '.childLinks', 
    over: function() {}, 
    over: function() { 
     getTreeLinks($(this).attr('id').split("treeLink")[1]); 
    }, 
    drop: function() { 
     updateGovLinks($(this).attr('id')); 
    } 
}); 

답변

1
다른 불리는 B해야 할 몇 초 동안 draged 항목을 길게 후 OVER 펑션 블록이 호출되는 원하는 드래그

다음과 같은 일종의 시간 초과를 사용하는 것이 좋습니다.

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

thankx its @Joe –