There is a table in the database where id / width / height / X / Y is. Understood a bit with the draggable plugin, but it is unclear how to create these windows based on the values ​​in the database. It turns out that somehow I need to bind the values ​​from the request to the window call function? I do not get you. Maybe there are any examples?

1 answer 1

Place your element initially in the right place using absolute positioning, substituting the required coordinates when generating html:

<div ... style="position:absolute; top:40px; left:120px; width:100px; height:50px">...</div> 

No additional actions are required in the script:

 $( function() { $( ".draggble" ).draggable(); } ); 
 .draggble{ border: 1px dotted #ccc; } 
 <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script><script src="https://code.jquery.com/ui/1.11.3/jquery-ui.min.js"></script> <div class="draggble" style="position:absolute; top:40px; left:120px; width:100px; height:50px">Test</div> 

  • I learned this, but it is necessary to somehow take and assign values ​​from the database - this is incomprehensible to me, I asked a question about this issue. But thanks anyway. - stow
  • Everything, figured out the data from the database, for some reason did not immediately guess. Thank. - stow