Loading ...
Sorry, an error occurred while loading the content.

10109Re: [ydn-javascript] 2px less while animating div in IE 7

Expand Messages
  • Matt Sweeney
    Feb 28, 2007
      Prashant Nair wrote:
      > I'm trying to move a div using the following code:
      >
      > var attributes = {
      > points: {
      > to: [200, 200]
      > },
      > width: {to: 200},
      > height: {to: 200}
      > };
      >
      > anim = new YAHOO.util.Motion(obj.id, attributes, 1,
      > YAHOO.util.Easing.easeOut);
      > anim.animate();
      >
      > ON IE 7:
      > the div moves to left:198 and top:198 insted of left:200 and top:200
      >
      > ON FF:
      > the div moves correctly to left:200 and top:200
      >
      >
      Hi Prashant,

      The xy coordinates of an element rarely match "top" and "left" values
      due to the many factors that affect an element's position.

      Do both report the correct value when you call "Dom.getXY" after setting
      the position?

      If you really just want to animate the "top" and "left" attributes, you
      don't need to use Motion. The "points" attribute of Motion maps to page
      coordinates, while top and left work within the element's positioning
      context (based on offsetParent).

      Matt
    • Show all 3 messages in this topic