.position() against two targets

.position() against two targets

I want to position an item relative to two elements, using 'top' from one element and 'right' from a different one. I thought I would try callig position() twice, one for the vertical position and again for the horizontal. Unfortunately, as anyone who actually reads the documentation knows, if you specify only one value in 'my', the other is added for you. What I tried was this:
  1. $("#page_tools").position({ my: "left", at: "right+2 ", of: "#layout_wrapper" }).position({ my: "top", at: "top-40", of: "#page_content" });
Naturally, this made a mess. I suggest adding 'none' to the options available for 'my', so my (future) code could look like this:
 
  1. $("#page_tools").position({ my: "left none", at: "right+2", of: "#layout_wrapper" }).position({ my: "top none", at: "top-40", of: "#page_content" });
 
 
With this, I can position my gadget by calling position()  twice, and if, for some reason, I want to position in only one dimension, I can do that as well.
 
OR - maybe there is a better way to accomplish this?
    • Topic Participants

    • ray