Can't you just do something like: $('map_bg').addEvent('mousedown', function(ev) { var pos = this.getPosition(); var rel = {x: ev.page.x - pos.x, y: ev.page.y - pos.y} });
On Mon, Oct 15, 2012 at 5:06 PM, Philip Thompson <philthath...@gmail.com>wrote: > I don't know if the event is affected by this, but it may depend on the > "display" property of the (parent) element being clicked. Try setting it to > relative or absolute and see if that gives you the numbers you want. Also, > a fiddle (jsfiddle.net) would allow us to play along as well. =D > > Happy coding, > ~Philip > > > On Sun, Oct 14, 2012 at 8:09 AM, Doidel <ad...@cok-game.com> wrote: > >> Hello guys >> >> I'd like to change >> *$('map_bg').addEvent('mousedown', function(ev) { ... });* >> to have its context as the element $('map_bg'). The goal is so that I can >> access ev.client.x / ev.client.y, i.e. get the click position relative to >> this element. >> >> http://mootools.net/docs/core/Types/DOMEvent let's me think that there >> is a way to change the context, but I couldn't figure it out yet... >> Thanks in advance for your help! >> > >