2017-07-08 15 views

答えて

0

のためにあなたが解決https://jsfiddle.net/wx4r7kz6/

setDraggable = function(){ 
 
    $div = $(document.createElement('div')).css({ 
 
     //blah blah (tested and working perfectly) 
 
     'width': '100px', 
 
     'height': '100px', 
 
     'display': 'inline-block', 
 
    \t \t 'border': '1px solid' 
 
    }); 
 
    $div.attr("id", "dragBox"); 
 
    $('body').append($div); 
 
    $('div#dragBox').draggable().resizable(); 
 
} 
 

 
setDraggable();
<link href="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.css" rel="stylesheet"/> 
 
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> 
 
<script src="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.js"></script>
に行かない新しい要素を作成し、 bodyにそれを追加し、格納容器に

function setDraggable(){ 
    $div = $(document.createElement('div')).css({ 
     //blah blah (tested and working perfectly) 
    }); 
    $('body').append($div); 
    $('div#dragBox'). draggable({ 
      containment : $div 
    }). resizable({ 
      containment : $div 
    }) 
} 

を設定します

関連する問題