摘要:<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>jQuery自定義動畫</title> &nbs
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>jQuery自定義動畫</title> <style type="text/css"> div{ width: 200px; height: 200px; background: red; border: 5px #000; position: absolute; } </style> <script src="jquery-3.3.1.min.js"></script> <script type="text/javascript"> $(document).ready(function () { $('.but1').click(function(){ $('p').animate({fontSize:'40px'},1500)//屬性名稱一律改成駝峰寫法 }) //同時操作多個css屬性 //使用預(yù)定義的值show hide toggle $('.but2').click(function(){ $('div').animate({ // left:'400px', // opacity:'0.3', // height:'400px', // width:'400px' width:'toggle', height:'toggle' },1500) }) $('#stop').click(function(){ $('div').stop() }) }) </script> </head> <body> <button class="but1">字體放大按柳</button> <p>jQuery中我們使用animate()方法創(chuàng)建自定義的動畫</p> <button class="but2">改變div按柳</button> <button id="stop">停止按柳</button> <div></div> </body> </html>
批改老師:韋小寶批改時間:2018-11-22 09:13:26
老師總結(jié):不錯不錯!代碼很完整!下次記得再加點總結(jié)就更不錯了哦!