html - Jquery animate is not working -


i try code not working please check following code:

<!doctype html>  <html lang="en">    <head>    <meta charset="utf-8">    <title>document</title>    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>  </head>    <body>    <button>click me</button>    <p style="width: 90px; background-color: #40ff08">this test peragraph</p>  </body>    </html>  <script>    $(document).ready(function() {      $("button").click(function() {        $("p").animate({          left: '400px'        });      });    });  </script>

that because position property of p element static , left won't work on static elements - change relative , works - see demo below:

$(document).ready(function() {    $("button").click(function() {      $("p").animate({        left: '400px'      });    });  });
p {    width: 90px;    background-color: #40ff08;    position: relative;  }
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>    <button>click me</button>  <p>this test peragraph</p>


Comments

Popular posts from this blog

python Tkinter Capturing keyboard events save as one single string -

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

javascript - Z-index in d3.js -