2011-08-05 7 views
0
헤이 난이 코드를 사용하여 드래그 가능한 요소를 복제하고 있습니다.

복제 된 "드래그 가능"요소는 "삭제 가능"영역에 반응하지 않습니다.

$('.draggable').draggable({helper: "clone"}); 
$('.draggable').bind('dragstop', function(event, ui) { 
    $(this).after($(ui.helper).clone().draggable()); 
}); 


$(".droppable").droppable({accept: ".draggable"}); 

어느 것이 좋습니다. 그러나 "복제 된"개체는 "삭제 가능"영역에 오래 반응하지 않습니다.

이 문제를 해결할 방법이 있습니까? draggable을 라이브로 만들 수 있습니까? 그래서 어떤 새로운 .draggable 요소는 droppable 요소와 반응합니까?

답변

0

helper:'clone' 누락 생각합니다.

은 모든 복제가 낙하 할과 상호 작용 Here

를 참조하십시오.

$('.draggable').draggable({helper: "clone"}); 
$('.draggable').bind('dragstop', function(event, ui) { 
    $(this).after($(ui.helper).clone().draggable()); 
}); 


$(".droppable").droppable({accept: ".draggable", 


     drop: function(event, ui) { 
      $(this) 
       .addClass("dropped").find("> p") 
        .html(document.lastModified);; 
     } 

}); 
0

다른 게시물에 대한 예로서이 도움이 되었습니까

$('.draggable').draggable({helper: "clone"}); 

$('.draggable').bind('dragstop', function(event, ui) { 
    $(this).after($(ui.helper).clone().draggable()); 


    //re-make objects draggable 
    $('.draggable').draggable({helper: "clone"}); 
}); 
... 
0

처럼하려고합니다.

http://jsfiddle.net/hHKh9/2/

나는 당신이 낙하 할에 상호 작용하는 drop -event 함수를 선언해야하는 droppable

관련 문제