1 <!DOCTYPE html> 2 <html> 3 <head> 4 <meta charset="utf-8" /> 5 <title></title> 6 <script src="js/jquery-1.11.3.js"></script> 7 <script> 8 $(function(){ 9 $("div").click(function(){ 10 if($(this).hasClass("aa")){ 11 $(this) 12 .animate({left:-10}) 13 .animate({top:-10}) 14 .animate({left:10}) 15 .animate({top:-10}) 16 .animate({left:-10}) 17 .animate({left:-10}) 18 } 19 $(this).animate({'left':-20,height:300}) 20 }); 21 22 23 24 }) 25 26 27 </script> 28 </head> 29 <body> 30 <div class="aa" style="width: 100px;height: 100px;background: red;position: absolute;"></div> 31 </body> 32 </html>