代码学习:
<!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"> div{ bacground:cornflowerblue; width:80px; height:60px; margin:2px; float:left; } img{ width:80px; height:60px; } </style> <script type="text/javascript"> $(function(){ //获取div 调用点击事件,隐藏当前被点击的这个div; $("div").click(function(){ $(this).hide(800,function(){ $(this).remove();//方法移除当前调用的这个方法的元素--自杀 }); }); }); </script> </head> <body> <h1>动画案列练习1(方法remove())</h1> <hr > <div><img src="1.jpg" ></div> <div><img src="2.jpg" ></div> <div><img src="3.jpg" ></div> <div><img src="4.jpg" ></div> </body> </html>
Nearth===>WEB前端--第23课/JQuery/常见的动画案列2(方法:remove()的使用)
最新推荐文章于 2021-09-26 21:16:14 发布