Javascript examples for jQuery Method and Property:animate
Animate left
<!DOCTYPE html> <html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> <script> $(document).ready(function(){ $(".btn1").click(function(){ $("p").animate({right: "+=100px"}); });//from www . j a v a2s. c o m $(".btn2").click(function(){ $("p").animate({right: "0"}); }); }); </script> </head> <body> <button class="btn1">Animate</button> <button class="btn2">Reset</button> <p style="position:absolute;right:0;">This is a paragraph.</p> </body> </html>