Margin animate problem with Monitor display settings

Posted by Jake on Stack Overflow See other posts from Stack Overflow or by Jake
Published on 2010-05-17T19:37:07Z Indexed on 2010/05/17 19:40 UTC
Read the original article Hit count: 393

Filed under:
|
|

I have an issue with an animation on a webpage. I have this div with text inside of it that I set the margin using css and when the page is loaded I use jquery to animate the div to a certain part of the page. The problem is it works with my concrete pixel settings, but if I change the properties of the monitor display settings in screen resolution(pixels), the div does not animate to the appropriate spot and it doesn't even start off at the appropriate spot from the css.

Sample code:

#div{
position:absolute;
top:20px;
left:50px
}

$("#div").animate({marginLeft: "250px"},2000);

Is there a way to have the settings of the animation margin end at the approriate position no matter what the screen resolution is?

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about css