????:<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <script src="前端課件/jQuery/jquery-3.3.1.min.
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <script src="前端課件/jQuery/jquery-3.3.1.min.js"></script> <style type="text/css"> .div_1{width: 100px;height: 100px;background: red;margin-top: 30px;position: absolute;} </style> </head> <body> <script> $(document).ready(function(){ $('#bt_1').click(function(){ $('.div_1').animate({left:'200px'},2000) $('.div_1').animate({top:'200px'},2000) $('.div_1').animate({left:'8px',opacity:'0.5'},2000) $('.div_1').animate({top:'8px',opacity:'0.5'},2000) }) $('#bt_2').click(function(){ $('.div_1').stop(true) }) }) </script> <button id="bt_1">開始</button> <button id="bt_2">停止</button> <div class="div_1"></div> </body> </html>
通過測試stop()的確如果沒有放true值只能停止第一個(gè)動(dòng)畫,后續(xù)動(dòng)畫會(huì)繼續(xù)執(zhí)行,放了true值后,就可以控制整個(gè)動(dòng)畫效果的停止位置。
?? ???:滅絕師太?? ??:2018-11-11 09:22:37
???? ??:練習(xí)的比較全面,繼續(xù)保持,必要的時(shí)候,要帶上筆記和備注