<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Document</title> <script src="./js/jquery.min.js"></script> <style> * { margin: 0; padding: 0; } .king { width: 400px; height: 200px; } li { list-style: none; position: relative; width: 100px; height: 200px; float: left; } .big { display: none; width: 100px; height: 200px; z-index: 1; } .current .big { display: block; } .small { width: 20px; height: 200px; position: absolute; left: 0; top: 0; z-index: 10; } </style> </head> <body> <div class="king"> <ul> <li class="current"> <a href=""><img src="./img/1.jpg" alt="" class="big"> <img src="./img/1.jpg" alt="" class="small"></a> </li> <li> <a href=""> <img src="./img/2.jpg" alt="" class="big"> <img src="./img/2.jpg" alt="" class="small"> </a> </li> <li> <a href=""><img src="./img/3.jpg" alt="" class="big"> <img src="./img/3.jpg" alt="" class="small"></a> </li> <li> <a href=""><img src="./img/4.jpg" alt="" class="big"> <img src="./img/4.jpg" alt="" class="small"></a> </li> </ul> </div> <script> $(function() { //鼠标经过小li $(".king li").mouseenter(function() { $(this).stop().animate({ width: 100 }, 200).find(".small").stop().fadeOut().siblings(".big").fadeIn(); //其余的编程69 $(this).siblings("li").stop().animate({ width: 20 }, 200).find(".small").stop().fadeIn().siblings(".big").fadeOut(); }) }); </script> </body> </html>