jQuery animate() right

Description

jQuery animate() right

View in separate window



<!DOCTYPE html>
<html>
<head>
<script 
 src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js">
</script>/*from w  ww . j  av a  2s .c om*/
<script>
$(document).ready(function(){
  $(".btn1").click(function(){
    $("p").animate({right: "+=100px"});
  });
  $(".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>



PreviousNext

Related