hey gafa - getPosition() does the trick (for the second option of getting the page document of the div). thanks ... i´d look through the docs tons of times without seeing this and it took you telling me to give it a another try to see that it was there.
that being said - it seems silly i cant get the value i want directly from the mouse-event.... maybe 1.3 could have something like "relative" object for a mouse event (e) such that e.relative.x = e.page.x - e.target.getPosition().x e.relative.y = e.page.y - e.target.getPosition().y cheers.b On Jun 14, 11: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.
