1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71
| <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title></title> <style type="text/css"> *{ margin: 0; padding: 0; } .list{ width: 450px; height: 200px; line-height: 200px; background-color: #333; margin: 30px auto; text-align: center; } h2{ color: white; height: 200px; } ul{ list-style: none; } li{ color: white; height: 40px; line-height: 40px; background-color: brown; border-bottom: dimgray 2px solid; } </style> </head> <body> <div class="list"> <h2>购物清单</h2> <ul class="goods"> <li>蔬菜</li> <li>水果</li> <li>果冻</li> <li>坚果</li> <li>巧克力</li> </ul> </div> </body> </html> <script src="js/jquery-3.5.1.js" type="text/javascript" charset="utf-8"></script> <script type="text/javascript"> $(function(){ $(".goods li").each(function(i){ $(this).hide().delay(i * 300).fadeIn(300); }).click(function(){ $(this).animate({ paddingLeft: 50, opacity:0 },500,"linear",function(){ $(this).remove(); }) }) }) </script>
|