如何用jq实现下拉框的简易方式

mac2026-05-25  3

重要的思路:

<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>test2</title> <style> .app{ width: 500px; margin: 100px auto; background-color: #ccc; } .m, .n{ width: 200px; height: 200px; float: left; } .m{ background-color: pink; } .n{ background-color: skyblue; display: none; } </style> </head> <body> <div class="app"> <div class="m"></div> <div class="n"></div> </div> <script type="text/javascript" src="../js/jquery-1.12.1.min.js"></script> <script> //核心代码 $(".app").hover(function () { $(this).children(".n").css("display", "block"); },function () { $(this).children(".n").css("display", "none"); }); </script> </body> </html>
注意:注重核心代码的实现
最新回复(0)