How to position Window relative to component

asked 2009-07-24 15:31:48 +0800

dastultz gravatar image dastultz
797 8


Suppose I have components A, B (hidden), C. I want to rollover A and show B (probably a Window) positioned a certain distance from C. I would like to do this with a CSA, though not totally necessary. I can hide and show with "action" but I don't know how to position it. Is there some cross-browser support for getting the position of any component? Something in "action", "anima", Effect, etc.? I don't want to write and maintain my own solution.



delete flag offensive retag edit

2 Replies

Sort by ยป oldest newest

answered 2009-07-26 12:04:19 +0800

nagkumar gravatar image nagkumar

Did you try using the getPosition() and setPosition() methods of Window (XULComponent)..

Raja Nagendra Kumar,

link publish delete flag offensive edit

answered 2009-07-27 12:31:56 +0800

dastultz gravatar image dastultz
797 8

Doing something like this:


comes pretty close, but I'd like the flexibility of positioning the Window next to any element - not just the parent. I'm currently using this (client side) JavaScript I got from a code repository to find the position of an element/component:
function getXYpos(elem) {
   if (!elem) {
      return {"x":0,"y":0};
   var xy={"x":elem.offsetLeft,"y":elem.offsetTop}
   var par=getXYpos(elem.offsetParent);
   for (var key in par) {
   return xy;


link publish delete flag offensive edit
Your reply
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools




Asked: 2009-07-24 15:31:48 +0800

Seen: 264 times

Last updated: Jul 27 '09

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More