Get your own website Result Size: 625 x 565
x
 
<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
<script>
$(document).ready(function(){
  $(".btn1").click(function(){
    $("#p1").animate({margin: "+=100px"});
  });
  $(".btn2").click(function(){
    $("#p1").animate({margin: "-=100px"});
  });
});
</script>
</head>
<body>
<button class="btn1">Animate +</button>
<button class="btn2">Animate -</button>
<p>This is a paragraph.</p>
<p id="p1" style="border:1px solid blue;">This is an animated paragraph.</p>
<p>This is a paragraph.</p>
</body>
<!-- Mirrored from www.w3schools.com/jquery/tryit.asp?filename=tryjquery_eff_ani_margin by HTTrack Website Copier/3.x [XR&CO'2014], Mon, 05 Sep 2022 15:43:26 GMT -->
</html>