javascript - JQuery CSS Animation -


i having trouble getting animation work.

$("#selectedtime").stop().animate({     "margin-left": "-=470px" },"fast", function() {     $(this).css({ "margin-left": "620px" })}).animate({     "margin-left": "-=470px" },"fast"); 

i sliding div left 470px, jumping 620px , sliding 470px left. $(this).css({ "marginleft": "620px" not seem working.

the initial margin-left 150px. after running script -790px. (150-470-470).

to start, you've got syntax errors:

$("#selectedtime").stop().animate({     "margin-left": "-=470px" },"fast", function() {              // ↓↓↓ here      $(this).css({ "margin-left": "620px"});  }).animate({     "margin-left": "-=470px" },"fast"); 

$("#selectedtime")     .stop()     .animate({"margin-left": "-=470px"}, "fast")     .animate({"margin-left": "620px"}, 0)     .animate({"margin-left": "-=470px"}, "fast"); 

demo: http://jsfiddle.net/mattball/j7rcr/


Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -