摘要:<!DOCTYPE html><html><head> <title></title> <script type="text/javascript" src="jquery-3.3.1.js"></script> <style type="text/css&q
<!DOCTYPE html> <html> <head> <title></title> <script type="text/javascript" src="jquery-3.3.1.js"></script> <style type="text/css"> div{ height: 200px; width: 200px; background: blue; position: absolute; } </style> <script type="text/javascript"> $(document).ready(function(){ $('#bt1').click(function(){ $('p').animate({fontSize:"50px"},1500)//屬性名稱font-size都寫成駝峰寫法fontSize }) $('#bt2').click(function(){ $('div').animate({//left:"500px" //opacity:0.3;//透明度 //height:300px //width:300px ////height:'toggle'; width:'toggle' },1500)//屬性名稱font-size都寫成駝峰寫法fontSize }) }) </script> </head> <body> <button id="bt1">點擊字體放大</button> <p>jQuery中我們使用 animate()方法創(chuàng)建自定義的動畫</p> <button id="bt2">點擊移動div</button> <div></div> </body> </html>