Note that there are some explanatory texts on larger screens.

plurals
  1. POjQuery, Move Point and Get Coordination
    primarykey
    data
    text
    <p>please visit this link and run the code.</p> <p><a href="http://jsfiddle.net/crisply/mQYVY/" rel="nofollow">http://jsfiddle.net/crisply/mQYVY/</a></p> <p>Explain briefly, Green box is added to gray area by clicking [Add box] button.</p> <pre><code>&lt;html xmlns="http://www.w3.org/1999/xhtml"&gt; &lt;head&gt; &lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8"/&gt; &lt;title&gt;&lt;/title&gt; &lt;script src="../Scripts/jquery-1.8.2.js"&gt;&lt;/script&gt; &lt;script src="../Scripts/jquery-ui-1.8.24.js"&gt;&lt;/script&gt; &lt;style type="text/css"&gt; .draggable { position: absolute; width: 10px; height: 10px; background: green; cursor: move; } #canvas { width: 500px; height: 400px; background: #ccc; position: relative; margin: 2em auto; } #results { text-align: center; background: yellow; } &lt;/style&gt; &lt;script type='text/javascript'&gt; //&lt;![CDATA[ $(function () { $(".draggable").draggable({ containment: "parent", }); $('#btn_add').click(function () { var htmlData = '&lt;div class="draggable"&gt;&lt;/div&gt;'; $('#canvas').append(htmlData); $(".draggable").draggable(); }); }); //]]&gt; &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;form id="form1" runat="server"&gt; &lt;div id="canvas"&gt; &lt;div class="draggable"&gt;&lt;/div&gt; &lt;/div&gt; &lt;div id="results"&gt;coordination&lt;/div&gt; &lt;input type='button' id="btn_add" value='Add box' /&gt; &lt;input type='button' id="btn_getCoord" value="Get Coordination" /&gt; &lt;/form&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>In addition to this code, i want to implement more.</p> <ol> <li><p>Click the <strong>[Add box]</strong> button, => <strong>point generate random location</strong>.</p></li> <li><p>Click the <strong>[Get Coordination]</strong> button, =><strong>get the coordination</strong> of several points and express result div (yellow area).</p></li> </ol> <p>Like this.</p> <p><em>-Coordination- <br /> x:230, y: 222 <br /> x:122, y: 233 <br /> x:423, y:55 <br /> x:50, y:30 <br /> ...</em></p> <p>Could you please give some components for me?</p> <p>I really appreciate your help.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload