[jQuery 1.4] jQuery.animate acting weird with left larger values


I had a requirement recently of using the jQuery.animate method and i was animating the left attribute of a div. Some thing like this.

$(“parentdiv”).stop().animate({“left”: (-($(“childdiv”).position().left))} , animSpeed, easeType);

it worked fine till some negative values like -10000 and after that it was acting weird running here and  there. I googled a lot for this problem and there are a lot of post on the internet, one of them which says set the position of the animating div to relative or absolute or fixed. i tried all that but it didnt work. I was going nuts and untill i found a post which said that this was a bug in jQuery 1.3 and was fixed in later release, But anyways i was using jQuery 1.4. but that was great hint!

So anyways the Solution to this problem is upgrade to the latest version of jQuery as it contains all the bug fixes. So i am now using jQuery 1.7.2 (latest at this point) and it works like a charm in all browsers.

Advertisements

About Dominic

J for JAVA more about me : http://about.me/dominicdsouza
This entry was posted in Thechy Stuff and tagged , , , . Bookmark the permalink.

2 Responses to [jQuery 1.4] jQuery.animate acting weird with left larger values

  1. Calvin Tennant says:

    Can you point me to the other resources referencing this problem that you found?

  2. Dominic says:

    right,
    here is one http://stackoverflow.com/questions/7455831/jquery-animate-and-google-chrome-issues this one says try appending “px” at the end of the left values in the animate function.

    then here is another one http://stackoverflow.com/questions/481288/jquery-animate-issues which says try using “border-something” or “margin-something” instead of left.

    both of these didn’t serve my purpose… but fine upgrade works for me.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s