jQuery animation delay method

JS 2014. 5. 21. 18:54


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<!DOCTYPE html>
<html>
    <head>
        <title>hello</title>
        <script src='./js/jquery-1.11.1.js'></script>
        <script src='./js/ch15.js'></script>
        <style>
            div{
                width: 100px; height: 100px;
                background-color: orange;
                position: relative;
}
        </style>
        <script>
            $(document).ready(function() {
                $('div').each(function(index) {
                    setInterval(function(){
                          $('div').eq(index).delay(index*500).animate({left: 500},'slow').animate({left:0},'slow');
                      },3000);
                });
            }); //ready
        
        </script>
    </head>
    <body>
        <div> </div><div> </div>
        <div> </div><div> </div>
        <div> </div><div> </div>
        
                        
    </body>
</html>
 


설정

트랙백

댓글