💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、星火、月之暗面及文生图 广告
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title></title> <style type="text/css"> *{ padding: 0; margin: 0; } #tab{ width: 600px; height: 500px; border: 4px solid orangered; margin: 30px auto; position: relative; } #tab ul li{ float: left; width: 200px; height: 50px; list-style: none; font-size: 30px; line-height: 50px; text-align: center; color: white; } #tab .con{ width: 580px; height: 420px; position: absolute; left: 10px; top: 70px; display: none; } </style> </head> <body> <div id="tab"> <ul> <li style="background: dodgerblue;">新闻</li> <li style="background: orchid;">体育</li> <li style="background: forestgreen;">娱乐</li> </ul> <div class="con" style="background: dodgerblue;display: block;"></div> <div class="con" style="background: orchid;"></div> <div class="con" style="background: forestgreen;"></div> </div> <script src="jquery-1.11.3.min.js" type="text/javascript" charset="utf-8"></script> <script type="text/javascript"> $("#tab ul li").mouseover(function(){ //获得移入的li的序号 var c = $(this).index(); //让c号con显示,兄弟con隐藏 $("#tab .con").eq(c).show().siblings('.con').hide(); //链式操作 //张三.扇一巴掌.踢一脚.打一拳.同桌.给个拥抱 }) </script> </body> </html>