Capturing coordinates and displaying divs on it

Kenpachi

New Member
I have a main div and i want to place some more divs on the coordinates which is captured when i click on it. Its working fine, it changes the top and left position of the div, but problem is that when i click again on the main div it drags the div which is already displayed on the first click. I want div which is displayed on the first click to stop moving when i click again on the main div. Help really appreciated. Code : \[code\] $(document).ready(function(){ $("#main_div").click(function(event, ui){ var x = event.pageX-document.getElementById("main_div").offsetLeft; var y = event.pageY-document.getElementById("main_div").offsetTop; document.pointform.form_x.value = http://stackoverflow.com/questions/12777288/x; document.pointform.form_y.value = y; $("#container-5").css({"top":y,"left":x}); $("#EDate").css({"top":y,"left":x}); }); });\[/code\]
 
Back
Top