position() keeps adding original "left" and "top" to current values in IE 8

position() keeps adding original "left" and "top" to current values in IE 8

Hi,
I've written some code to position a dropdown using the "position" method that's new in 1.8, and I'm getting some weird behaviour. The code looks like this:

  1. jQuery("#bar").click(new function(event) {
  2.   jQuery("#foo").position( {
  3.     my : "left top",
  4.     at : "left bottom",
  5.     of : "#bar",
  6.   });
  7.   jQuery("#foo").show();
  8.   event.stopPropagation();
  9. });
Another event handler (on document) hides the dropdown.

In Firefox (3.6.2) this works every time I click #bar. #foo show up in the right place. However, the exact same code in IE moves #foo on every click (ie invocation of position()). It positions the element right the first time, but for each subsequent call it adds the original "top" and "left" values to the current values. So let's say Firefox positions the element at (15,10). For the first invocation, IE also places it there, but the next invocation places the element at (30,20), and then (45,30) etc.

Removing the position() call results in the object being show in the wrong place, but consistently so. So there's nothing else affecting the "top" and "left" values, as far as I can tell.

Anyone have any idea what's going on?

Regards,
Maarten

PS. I'm using the jQuery notation because we're migrating from DomAssistant.