(062)jquery_动画_animate2

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
<html>
  <head>
    <title>animate_animate1.html</title>
    
    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    <meta http-equiv="description" content="this is my page">
    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
    
    <!--<link rel="stylesheet" type="text/css" href="./styles.css">-->
    <style type="text/css">
        span
        {
            position:absolute;
            width:80px;
            height:80px;
            border: solid 1px #ccc;
            margin: 0px 8px;
            background-color: red;
            color:white;
            vertical-align:middle
        }
    </style>
    <script type="text/javascript" src="../js/jquery/jquery190.js"></script>
    <script type="text/javascript">
        $(function(){
            $("span").animate({
                left:"+100px"
            },3000,function(){
                $(this).animate({
                    width:"300px",
                    height:"300px"
                },3000,function(){
                    $("tip").html("动画执行完成");
                });
            });
        });
    </script>
  </head>
  
  <body>
        <h3>制作简单的动画效果</h3>
        <span></span>
        <div id="tip"></div>
  </body>
</html>

调用animate()方法不仅可以制作简单渐渐变大的动画效果,而且还能制作移动位置的动画,在移动位置之前,必须将被移元素的“position”属性值设为“absolute”或“relative”,否则,该元素移动不了。

posted @ 2014-12-30 12:01  雪中飞雁  阅读(90)  评论(0)    收藏  举报