var doc = element.ownerDocument;
var x = element.getBoundingClientRect().right
+ doc.getBoxObjectFor(doc.documentElement).screenX
+ doc.documentElement.scrollLeft;
and I get right border position.
but firefox3 outputs in console:
> Warning: Use of getBoxObjectFor() is deprecated. Try to use
> element.getBoundingClientRect() if possible.
Problem is getBoundingClientRect will not get screenX. Should I still use
getBoxObjectFor even if deprecated for html elements, or is there anothery way
to get screen position of an element ?
thanks
>Problem is getBoundingClientRect will not get screenX. Should I still use getBoxObjectFor even if deprecated for html elements, or is there anothery way to get screen position of an element ?
>
>
Are you opening the popup as a result of a mouse event? Perhaps you
could use the screen and client coordinates of the mouse to calculate
the screen position of the element.
--
Warning: May contain traces of nuts.
It would be better to just use the menupopup's openPopup method which
can position popups relative to other elements for you. The following
opens and aligns a popup with the right edge of an element:
popup.openPopup(element, "end_before");
Thanks,
at first, I did not want to use openPopup because I want the popup to be
"inside" element, and there is no position argument that can do that.
----------------------
| |
| element |
| _____|
|_______________|____| <- popup
But I had not noticed aX and aY arguments to that function. So now, I use:
popup.openPopup(element, "end_after", 0 - popupwidth);
I get popupwidth in popupshowing event first time popup appears.
Thanks for your help
arno