abstract:<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <script src="https://code.jquery.com/jquery-3.1.1.min.js">
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <script src="https://code.jquery.com/jquery-3.1.1.min.js"></script> <title>下滑线导航</title> <style> *{margin: 0 ;padding: 0;} ul{width: 900px;height: 60px;line-height: 60px;margin: 0 auto;background: #ccc;position: relative;} ul li{width: 100px;height: 60px;text-align: center;list-style: none;float: left;font-size: 18px;} ul li:hover{color:#6500ff;background: cyan;} .line{width: 96px;border: 2px solid coral;position: absolute;left:270px;top:56px;} </style> </head> <body> <ul class="uu"> <li name='0'>产品发布</li> <li name='1'>规格选型</li> <li name='2'>技术要求</li> <li name='3'>联系我们</li> <li name='4'>最新技术</li> </ul> <div class="line"></div> <script tpye="text/javascript"> $(function(){ // $('.line').hide(); $('li').mouseover(function(){ $x = parseInt($(this).attr('name'))*100 $y = $x+270 $('.line').stop().animate({left:$y+'px'}) $('li').mouseleave(function(){ $('.line').stop().animate({left:'270'+'px'}) }) }) }) </script> </body> </html>
Correcting teacher:韦小宝Correction time:2019-02-28 09:13:47
Teacher's summary:写的很不错 效果也是很好看的 课后要记得多去练习