abstract:<!DOCTYPE html> <html> <head> <title>jQuery的動(dòng)畫(huà)效果--停止動(dòng)畫(huà)</title> <meta charset="utf-8"> <script type="text/
<!DOCTYPE html> <html> <head> <title>jQuery的動(dòng)畫(huà)效果--停止動(dòng)畫(huà)</title> <meta charset="utf-8"> <script type="text/javascript" src="jquery-3.3.1.min.js"></script> <style type="text/css"> #box2,#box1{ width: 500px; padding:5px; text-align:center; background-color:#FFFFFF; border:solid 1px #E9E9E9; } #box2{ width: 500px; padding:5px; display:none; } </style> <script> $(document).ready(function(){ $("#box1").click(function(){ $("#box2").slideToggle(3000) // $("#box").slideUp("slow"); }); $("#stop").click(function(){ $("#box2").stop(true); }); }); </script> </head> <body> <button id="stop">停止</button> <div id="box1">開(kāi)始滑動(dòng)</div> <div id="box2"><p>PHP中文網(wǎng):獨(dú)家原創(chuàng),永久免費(fèi)的在線php視頻教程,</p><p>php技術(shù)學(xué)習(xí)陣地!</p></div> </body> </html>
向上/向下滑動(dòng)+停止還算正常,但是有個(gè)問(wèn)題,點(diǎn)停止之后,div中的字會(huì)多出來(lái)。不知道是哪里的問(wèn)題。
Correcting teacher:滅絕師太Correction time:2018-11-15 14:24:23
Teacher's summary:因?yàn)槟阃V沟氖莇iv的效果,內(nèi)部的p標(biāo)簽的文字沒(méi)有停止呀……