代码学习:
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Nearth</title> <script src="jquery-3.3.1.min.js" type="text/javascript" charset="utf-8"></script> <style type="text/css"> *{ margin:0px; padding: 0px; } div{ width:200px; height: 100px; background-color: aquamarine; position: absolute; } </style> <script type="text/javascript"> //匿名函数--回调函数的使用 $(function(){ $("#btn").click(function(){ $("div").animate({"width":"300px","height":"300px","left":"300px"},1000,function(){ $("div").animate({"width":"50px","height":"30px","left":"800px","top":"300px","opacity":0.2},2000); }); }); }); </script> </head> <body> <input type="button" name="" id="btn" value="显示效果" /> <hr > <div id="dv"> </div> </body> </html>
Nearth===>WEB前端--第23课/JQuery/动画案列4(animate(),回调函数(匿名函数))
最新推荐文章于 2019-11-16 17:30:09 发布