サマリー: 通過該實例的學習讓我對jQuery動畫有了更新的認識,感覺老是講的這個下劃線跟著導航走有點麻煩,我自己用添加類和刪除類做了一個下劃線跟著導航走的實例,實例如下:<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>下劃線
通過該實例的學習讓我對jQuery動畫有了更新的認識,感覺老是講的這個下劃線跟著導航走有點麻煩,我自己用添加類和刪除類做了一個下劃線跟著導航走的實例,實例如下:
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>下劃線跟著導航走</title> <link rel="shortcut iocn" type="image/x-icon" href="../picture/mi.png"> <script type="text/javascript" src="jquery-3.3.1.min.js"></script> <style type="text/css"> .menu{width: 450px;height: 44px;margin: 0px auto;margin-top: 20px;background-color: #ccc;} .oneMenu li{float: left;width: 100px;height: 40px;line-height: 40px;text-align: center;/*border-bottom: 4px solid pink;*/list-style: none;margin: 0px auto;cursor: pointer;} .bt{border-bottom: 4px solid pink;} </style> </head> <body> <!-- 導航條menu --> <div> <ul> <li>首頁</li> <li>視頻</li> <li>新聞</li> <li>體育</li> </ul> </div> <script type="text/javascript"> $(document).ready(function(){ // 鼠標移上出現(xiàn)下劃線 $('.oneMenu>li').mousemove(function(){ $(this).addClass('bt'); }) // 鼠標離開下劃線消失 $('.oneMenu>li').mouseleave(function(){ $(this).removeClass('bt') }) }) </script> </body> </html>
添削の先生:韋小寶添削時間:2018-12-13 17:05:19
先生のまとめ:寫的很不錯哦!課后記得多練習練習類似的案例哦!