1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 2 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 3 <html xmlns="http://www.w3.org/1999/xhtml"> 4 <head> 5 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 6 <title>Panel控制Div運動,由大到小變化。</title> 7 <style type="text/css"> 8 *{margin:0;padding:0;} 9 body { padding: 60px } 10 #panel {position: relative; width: 100px; height:100px;border: 1px solid #0050D0;background: #96E555; cursor: pointer} 11 </style> 12 <script type="text/javascript" src="http://keleyi.com/keleyi/pmedia/jquery/jquery-1.11.2.min.js"></script> 13 <script type="text/javascript"> 14 $(function(){ 15 $("#panel").css("opacity", "0.5");//設置不透明度 16 $("#panel").click(function(){ 17 $(this).animate({left: "400px", height:"200px" ,opacity: "1"}, 3000) 18 .animate({top: "200px" , width :"200px"}, 3000 ,function(){ 19 $(this).css("border","5px solid blue"); 20 }) 21 }); 22 }); 23 </script> 24 </head> 25 <body> 26 <div id="panel"></div> 27 </body> 28 </html>