I want to covert a point, positioned in one DIV into a point wrt another DIV.
I have a following html in place
<html>
<head>
<link href="default.css" rel="stylesheet" />
<script src="default.js"></script>
</head>
<body>
<div id="complete_canvas" >
<div id="myDIV"></div>
<div id="otherDIV"></div>
</div>
</body>
</html>
the default.css has following in it
#complete_canvas
{
width:100%;
height:100%;
position:absolute;
}
#myDIv{
position:absolute;
left:100px;
top:100px;
width:760px;
height:100px;
}
in the default.js i am adding event listeners for
var canvas = getElem("complete_canvas");
canvas.addEventListener("mousedown", onTouchDownOnDOMCanvas, false);
now, the point i get in onTouchDownOnDOMCanvas function is wrt to complete_canvas DIV.
i want this point wrt to myDIV div element.
so, for eg:, if i click at 100px , 100px (in complete_canvas) then i wrt to myDiv it will be 0 , 0
is there a way to do that conversion ?
thanks,
Using jquery
Using Javascript