I want to understand how to calculate the dimensions in pixels from the form side (red arrows in the figure) and the size of the window Channel 1 and Channel 2 and send them in two different POST requests via AJAX. In this case, I need to pass such a value - <channel> <hstart (пиксели когда начинается channel1 сверху)> <hsize (размер окна hight)> <vstart (пиксели когда начинается channel1 с лева[всегда с лева считается])> <vsize (размера окна width)> .
<!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>jQuery UI Draggable - Snap to element or grid</title> <link rel="stylesheet" href="//code.jquery.com/ui/1.12.0/themes/base/jquery-ui.css"> <link rel="stylesheet" href="/resources/demos/style.css"> <style> .draggable2 { width: 90px; height: 80px; padding: 5px; float: left; margin: 0 10px 10px 0; font-size: .9em; margin-left: 10px; position: absolute; left: 0px; top: 300px; } .draggable3 { width: 90px; height: 80px; padding: 5px; margin: 0 10px 10px 0; font-size: .9em; margin-left: 10px; position: absolute; left: 120px; top: 300px; } .ui-widget-header p, .ui-widget-content p { margin: 0; } /* Разрешение экрана нужно получать */ #snaptarget { height: 270px; width: 480px; } .ui-resizable-helper { border: 2px dotted #000000; } </style> <script src="https://code.jquery.com/jquery-1.12.4.js"></script> <script src="https://code.jquery.com/ui/1.12.0/jquery-ui.js"></script> <script> $(function() { $("#draggable2").draggable({ snap: ".ui-widget-header", snapMode: "outer" }); /* Перемещение объекта */ $("#draggable2").resizable({ helper: "ui-resizable-helper", containment: "#snaptarget" }); /* Увелечение/Уменьшение объекта */ $("#draggable3").draggable({ snap: ".ui-widget-header", snapMode: "outer" }); /* Перемещение объекта */ $("#draggable3").resizable({ helper: "ui-resizable-helper", containment: "#snaptarget" }); /* Увелечение/Уменьшение объекта */ }); </script> </head> <body> <div id="snaptarget" class="ui-widget-header"> </div> <br style="clear:both"> <div id="draggable2" class="draggable2 ui-widget-content"> <p>CHANNEL 1</p> </div> <div id="draggable3" class="draggable3 ui-widget-content"> <p>CHANNEL 2</p> </div> </body> </html> 