You have to do the math yourself. get the x/y from the event object, then the position of the container with element.position, etc.
On Mon, Jun 14, 2010 at 8:23 AM, Gafa <[email protected]> wrote: > Look at Mootools Docs: > > http://mootools.net/docs/core/Element/Element.Dimensions > > or > > http://mootools.net/docs/more/Element/Element.Measure > > I don't know how you could accomplish getting the x/y position of > something from the mouse without somehow referencing some object. > > On Jun 14, 11:05 am, brook <[email protected]> wrote: > > Hello All - Is there a smart way to get the position of a mouse-event > > relative to to div? in this example: > > > > http://jsfiddle.net/E3gp8/ > > > > If you click on on the green square from the event you can get its > > client/page.x but what i really want is the the position of the click > > event with respect to the "inner" div. obviously i could subtract off > > the left value of the "container" + the left value of the "inner" div. > > but i want it to be as flexible as possible so it doesn´t matter the > > structure of the dom that it is placed in. > > > > If not is there a way to get the value of the x-position of a div... > > so in this case the "container" has left=50px and the the "inner" has > > left=50 but is there away to get the left value relative to the page > > of the inner div (in this case 50+50 = 100). Again I want to get this > > info without referencing the containing div or divs so that its as > > flexible as possible. >
