Ryan Nichols wrote:
Not only would you not want to, but it wouldn't matter. If the elements
set to fixed it will do nothing to set it's top and left properties.
Oops. :).
Your snippet might work for setting the position, but for the other
functions like centering the element in the window, and the fromX
functions it must be absolute.
Why?. You can calculate the absolute position to get the element where
you want, and then translate it to relative.
I'd also like to add to it,
offsetFromElement(e, x, y)
Maybe adding the offset method to Coordinate would help to make it more
generic?:
elementPosition(element).offset(x, y)
offsetFromMouse(x, y)
Or:
mousePosition().offset(x, y)
But how do you get the mouse position without a mouse event?.
This would be a major convenience function for generating tooltip like
items, or other contextual windows.
Yeah!
--
Leonardo Soto M.