Look at the Position code in prototype, I think everything you'll need is there. It's near the bottom of the file, unless something changed.
Greg > -----Original Message----- > From: rubyonrails-spinoffs@googlegroups.com [mailto:rubyonrails- > [EMAIL PROTECTED] On Behalf Of Fabian Lange > Sent: Friday, September 22, 2006 4:09 PM > To: rubyonrails-spinoffs@googlegroups.com > Subject: [Rails-spinoffs] Getting the coordinates of an event of an object > > > Hi, > I just encountered a situation where I want to know the position of the > mouse pointer of an element. > I consider this a pretty basic functionality, but Prototype gives me only: > Event.pointerX(event) > Event.pointerY(event) > > So I thought adding: > > elementX: function(event) { > return this.pointerX(event)-Element.getX(this.element(event)); > }, > > elementY: function(event) { > return this.pointerY(event)-Element.getY(this.element(event)); > }, > > But wait there is no Element.getX. I found out that obtaining the X/y of > an > element is not trivial at all, but even more in this case I expect it to > be > handled in a library. > > Do I miss something or has anyone a reliable and fast implementation for > Element.getX? > > Br > Fabian > > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs -~----------~----~----~----~------~----~------~--~---