jQuery Multiple Draggable Object Creation -


this complicated problem me. here want:

i have designed div draggable , 1 instance on page ready dragging. when user drags it, want dynamically create new instance of it. should able remove click of button should accessable.

can point me out right path this?

here have far:

$(document).ready(function() {              $('#dragthis').resizable({                 stop: function(event, ui) {                     var w = $(this).width();                     var h = $(this).height();                     var tr = $('#contentdiv');                     tr.each(function() {                         //alert( fields[$(this).index()] )                         $(this).height(h - 45);                     });                       console.log('stopevent fired')                     console.log('width:' + w);                     console.log('height:' + h)                 }             }).draggable(             {                 containment: $('body'),                 drag: function() {                     var offset = $(this).offset();                     var offsetimage = $("#<%=drophere.clientid %>").offset();                     var xpos = offset.left;                     var ypos = offset.top;                      $('#posx').text('x: ' + xpos);                     $('#posy').text('y: ' + ypos);                  },                 stop: function() {                     var finaloffset = $(this).offset();                     var finalxpos = finaloffset.left;                     var finalypos = finaloffset.top;                      $('#finalx').text('final x: ' + finalxpos);                     $('#finaly').text('final x: ' + finalypos);                 }             }); 

and here html:

<div class="dragthis" id="dragthis">                     <div class="content" id="contentdiv">                         <p>                             <asp:label id="lblcontent" width="2px" runat="server" text="label"></asp:label>                         </p>                     </div>                     <div class="pointer">                         <div class="one">                         </div>                         <div class="two">                         </div>                     </div>                 </div> 

i'm able resize, drag , location of 1 div. need make work multiple divs.

please remember need access these divs (positions , texts inside them - setting , getting)

any appreciated.

thank you

wrap code callable function. then, when create new div should use "destroy" methods destory current instances of resizable+draggable (

$('#dragthis').resizable('destroy').draggable('destroy'); 

) , run function reinitialize resizable + draggable;


Comments

Popular posts from this blog

python - Scipy curvefit RuntimeError:Optimal parameters not found: Number of calls to function has reached maxfev = 1000 -

c# - How to add a new treeview at the selected node? -

java - netbeans "Please wait - classpath scanning in progress..." -