abstrakt:<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>Document</title> <style type="text/css"> body{font-size:12px;}
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>Document</title> <style type="text/css"> body{font-size:12px;} div{width:100px;height:100px;background:red;position:absolute;} </style> <script type="text/javascript" src="js/jquery-3.3.1.js"></script> </head> <body> <button id="bt1">開(kāi)始動(dòng)畫(huà)</button> <div>我也會(huì)動(dòng)</div> <script type="text/javascript"> $(document).ready(function(){ $('#bt1').click(function(){ $('.div1').animate({height:'500px'},'slow') $('.div1').animate({width:'500px'},'slow') $('.div1').animate({fontSize:'100px',fontWeight:'bold'}) $('.div1').animate({height:'100px'},'fast') $('.div1').animate({width:'100px'},'fast') $('.div1').animate({fontSize:'12px',fontWeight:'normal'}) }) }) </script> </body> </html>
方法類(lèi)似于CSS,但是更加簡(jiǎn)單化。
通過(guò)事件觸發(fā)動(dòng)畫(huà),動(dòng)畫(huà)通過(guò)隊(duì)列一個(gè)個(gè)展示,變成最后的效果