Setting left/top position not working in IE

Posted by Brian on Stack Overflow See other posts from Stack Overflow or by Brian
Published on 2010-05-15T12:07:55Z Indexed on 2010/05/15 12:14 UTC
Read the original article Hit count: 248

Filed under:
|
|

Hello,

In a custom ASP.NET AJAX control, i have this to do some repositioning.

var dims = Sys.UI.DomElement.getBounds(control);
this.get_element().style.position = "absolute";
//Sys.UI.DomElement.setLocation(this.get_element(), dims.x, (dims.y + dims.height));

this.get_element().style.left = dims.x;
this.get_element().style.top = (dims.y + dims.height);

getBounds simply returns the x/y and width/height. I use this to set the left/top, but in IE, it's doubling; say the coordinates are 500, 20; when it sets this on the element, its actually setting to 1000, 40. Any ideas why? In firefox, this works correctly.

this.get_element() returns the correct element and all, but it's not setting correctly, even though event logging says it's the correct coordinates. When using setLocation too, it doesn't work in either...

What else in my code may be affecting it? JQuery isn't an option here too.

Thanks.

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about JavaScript