HTML:
<!DOCTYPE html> <html lang="en"> <head> <script src="/jquery-2.1.4.js" type="text/javascript"></script> <script src="/index.js" type="text/javascript" defer></script> <meta charset="UTF-8"> <title></title> </head> <body> <div class="animation" style="position: absolute"> I am the text which is going to be animated </div> </body> </html>
JS:
/*global $*/ $(".animation").animate({ left: "+=500" }, 5000, function () { alert("finish!"); });
Taken from here.