JQuery implements a simple example of animation

  • 2020-03-30 01:27:20
  • OfStack

One, demand reasons
At present, jQuery has been a relatively mature framework, and there are hundreds of plug-ins based on it. In this case, I use jQuery to achieve an animation effect.

Two, concrete implementation


<!DOCTYPE html PUBLIC "-//W3C//DTDHTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type"content="text/html; charset=UTF-8">
<title>jQuery animating </title>
<script language="JavaScript"src="../jQuery/jquery-1.7.1.min.js"></script>
<style type="text/css">
     #test {
         position:relative;
         width:100px;
         height:100px;
         border:1px solid #0050d0;
         background:#96e555;
          cursor:pointer;
     }
</style>
<script type="text/javascript">
     $(function(){
         $("#test").css("optcity","0.5");//Set opacity
         $("#test").click(function(){
              $(this).animate({left:"400px",height:"200px",opacity:"1"},300)
                      .animate({top:"200px",width:"200px"},300)
                      .fadeOut("slow");
         });
     });
</script>
</head>
<body>
     <div id="test"></div>
</body>
</html>

Iii. Operation results

< img Alt = "" border = 0 SRC =" / / files.jb51.net/file_images/article/201401/20140127084915.png ">


Related articles: