2009-12-19 5 views
1

나는이 작품을 만들기 위해 열심히 노력하고 있습니다! 내가 draggable하게 div 안에 이미지 목록이 있습니다. 끌기가 시작될 때 열려있는 대화 상자도 있습니다. 왠지 나는이 대화 상자 안에 들어갈 수 없다. 대화 상자를 제외하고 페이지의 다른 모든 곳에 드롭 할 수 있습니다.대화 상자에 드래그 앤 드롭

$(document).ready(function(){ 
    // Executed once all the page elements are loaded 
    //setup new person dialog 
    // Change overlay color and opacity 
    $('#sample').dialog({ 
     //dialog options 
     autoOpen: false, 
       draggable: false, 
       modal: false, 
       show: 'explode', 
       closeOnEscape: true, 
       position: 'top', 
       minHeight: '400', 
       minWidth: '600', 
       width: 750, 
       title: "Some title", 
       open: function(type, data) { 
        $(this).parent().appendTo("form"); 
       } 
     }); 
$(".random-img").draggable(
     { 
      cursor: "move", 
      helper: "clone", 
      opacity: "0.5", 
      zIndex: "2700", 
      containment: "document", 
      handle: ".random-img", // makes toolbar the dragable part 
      drag: function(ev, ui) { 
       $('#sample').dialog("open"); 
      } 
     } 
    ); 
    $("#sample").droppable(
    { 
     accept: ".random-img", 
     tolerance: "touch", 
     drop: function(ev, ui) 
     {     
      var droppedItem = ui.draggable.clone().addClass('sclass');     
       $(this).append(droppedItem);        
     }  
    } 
    ); 
    }); 

</script> 
<html> 
<head> Page test </head> 
    <body> 
      <div class="random-img"> 
       <img src="images/someimage.jpg" />    
      </div> 
       <div id='sample'> 
       </div> 
    </body> 
</html> 

어떤 도움이나 통찰력이 크게 감사합니다 : 여기 내 코드입니다.

감사합니다.

+0

'$ (ui.draggable) .clone(). addClass ('sclass ')' – czarchaic

+0

감사합니다. czarchaic, 내가 언급 한 내용을 추가했지만 여전히 작동하지 않습니다. 내가 대화 상자 옵션을 가지고 놀았을 때 한가지 보았지만, autoOpen : true로 설정하면 완벽하게 작동합니다! 그러나 페이지가로드 될 때 열지 않기를 바랍니다. – paravamu

답변

1

나는 마침내 그것을 얻었다! 노력하고 몇 시간 후,이 작품. 나는 대화 상자 열기 메서드를 draggable : draggable : start로 드래그했습니다. 그런 다음 draggable 메서드에서 this.helper가 null이거나 firefox 도구 -> 오류 콘솔에있는 객체가 아니라는 오류가 발생하기 시작합니다.

나는 파이어 버그를 무시하고 이제는 완벽하게 작동합니다!

도움 주셔서 감사합니다. Praveen