摘要:<!DOCTYPE html> <html> <head> <meta charset="UTF-8">
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <title>重新布局下劃線跟隨導(dǎo)航</title> <script src="https://code.jquery.com/jquery-3.1.1.min.js"></script> <style> * { margin: 0; padding: 0; } .nav { width: 1200px; height: 42px; background: #029cff; margin: 20px auto; position: relative; box-shadow: 0 2px 20px #000; border-radius: 4px; } /* ul { border-radius: 10px; } */ ul li { float: left; list-style: none; width: 120px; line-height: 40px; color: #fff; text-align: center; } .line { width: 120px; height: 4px; background: #fff; z-index: 999; position: absolute; top: 38px; } </style> </head> <body> <script> $(document).ready(function() { $('li').hover( function() { $num = parseInt($(this).attr('name')) * 120; $('.line').stop().animate({ left: $num + 'px' }, 300); }, function() { $('.line').stop().animate({ left: '0px' }, 300); } ) }) </script> <div> <ul> <li name="0">網(wǎng)站首頁(yè)</li> <li name="1">公司簡(jiǎn)介</li> <li name="2">新聞中心</li> <li name="3">產(chǎn)品介紹</li> <li name="4">工程案例</li> <li name="5">售后服務(wù)</li> <li name="6">在線咨詢</li> <li name="7">人才招聘</li> <li name="8">相關(guān)知識(shí)</li> <li name="9">聯(lián)系我們</li> </ul> <div></div> </div> </body> </html>
批改老師:滅絕師太批改時(shí)間:2019-02-28 09:36:43
老師總結(jié):必要的地方可以附上備注哦!整體完成的不錯(cuò)!