abstrait: <!DOCTYPE html> <html> <head> <title>下滑線跟隨導(dǎo)航</title> <meta charset="utf-8"/> <script typ
<!DOCTYPE html> <html> <head> <title>下滑線跟隨導(dǎo)航</title> <meta charset="utf-8"/> <script type="text/javascript" src="jquery.js"></script> <style type="text/css"> *{padding:0;margin:0;} ul {list-style: none;z-index:20;position:relative;font-size: 15px;} li {float:left;cursor:pointer;width:100px;height: 30px;text-align:center;line-height:30px;color: #fff;font-weight: bold;} .menu{width:500px;position:fixed; bottom:0px ;left:0px;right:0px; margin:0 auto;height:32px;box-shadow: 0 2px 20px #000;background: #b6cce2;border-radius:3px } </style> <script type="text/javascript"> $(function(){ $('li').hover( function(){ $x=parseInt($(this).attr('name'))*100 $('.block').stop().animate({left:$x+'px'},300) }, function(){ $('.block').stop().animate({left:'0px'},300) } ) }) </script> </head> <body> <div class="menu"> <ul> <li name="0">首頁</li> <li name="1">公司新聞</li> <li name="2">產(chǎn)品介紹</li> <li name="3">關(guān)于我們</li> <li name="4">聯(lián)系我們</li> </ul> <div class="block" style="z-index:10;width:100px;height:2px;background:#fff;position:absolute;top:30px;"></div> </div> </body> </html>
Professeur correcteur:西門大官人Temps de correction:2019-04-09 09:53:46
Résumé du professeur:建議給js代碼加點注釋。寫上自己的實現(xiàn)思路,印象會更深一些