1. <!DOCTYPE html>
    2. <html lang="en">
    3. <head>
    4. <meta charset="UTF-8">
    5. <meta name="viewport" content="width=device-width, initial-scale=1.0">
    6. <title>Document</title>
    7. <script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.5.1/jquery.js"></script>
    8. <style>
    9. .parent {
    10. width: 500px;
    11. position: relative;
    12. border: 1px solid #333;
    13. height: 500px;
    14. }
    15. .center {
    16. position: absolute;
    17. border: 1px solid #ff2d51;
    18. width: 100px;
    19. height: 100px;
    20. top: 50%;
    21. left: 50%;
    22. transform: translate(-50%, -50%);
    23. }
    24. .child {
    25. width: 50px;
    26. height: 50px;
    27. position: absolute;
    28. }
    29. .one {
    30. left: 10px;
    31. top: 10px;
    32. background-color: red;
    33. }
    34. .two {
    35. top: 10px;
    36. right: 10px;
    37. background-color: yellow;
    38. }
    39. .three {
    40. left: 10px;
    41. bottom: 10px;
    42. background-color: green;
    43. }
    44. .four {
    45. bottom: 10px;
    46. right: 10px;
    47. background-color: blue;
    48. }
    49. .child:not(:nth-child(1)){
    50. display: none;
    51. }
    52. </style>
    53. </head>
    54. <body>
    55. <div class="parent">
    56. <div class="content">
    57. <div class="child one">
    58. </div>
    59. <div class="child two">
    60. </div>
    61. <div class="child three">
    62. </div>
    63. <div class="child four">
    64. </div>
    65. </div>
    66. </div>
    67. <script>
    68. let index = 0;
    69. let $divs = $(".content .child:not(:nth-child(1))");
    70. let len = $divs.length;
    71. $(".one").mouseover(function(){
    72. show(len);
    73. })
    74. function show(len) {
    75. setTimeout(() => {
    76. if (index < len) {
    77. $divs.eq(index).fadeIn();
    78. index++;
    79. show(len);
    80. }
    81. }, 1000);
    82. }
    83. </script>
    84. </body>
    85. </html>