abstrakt:<!DOCTYPE html><html lang="en"><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0">&
<!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>jQuery實例-三級菜單</title> <script src="jquery-3.3.1.js"></script> <style> * { margin: 0px; padding: 0px; } .menu { width: 800px; height: 35px; margin: 0px auto; background: lightcyan; margin-top: 20px; color: #7f69d1; border: 1px solid #ccc; border-radius: 5px; } ul { list-style: none; } ul li { width: 100px; height: 35px; line-height: 35px; text-align: center; float: left; border-right: 1px solid #ccc; cursor: pointer; } .two li { width: 100px; height: 30px; line-height: 30px; background: lightblue; color: #034b33; font-size: 14px; position: relative; border: 0px; } .two li:hover { background: #034b33; color: #7f69d1; } .three { position: absolute; top: 0px; left: 100px; } .three li { width: 99px; height: 30px; line-height: 30px; border: 0px; } </style> <script> $(function(){ //隱藏二級與三級下拉菜單 $('.two').hide(); $('.three').hide(); //當鼠標移動到包含二級菜單的一級菜單時顯示當前二級菜單 $('.one>li').mouseover(function(){ $(this).find('.two').slideDown(500) }) //當鼠標移出包含二級菜單的一級菜單時隱藏當前二級菜單 $('.one>li').mouseleave(function(){ $(this).find('.two').slideUp(500) }) //當鼠標移動到包含三級菜單的二級菜單時顯示當前三級菜單 $('.two_li').mouseover(function(){ $(this).find('.three').slideDown(500) }) //當鼠標移出包含三級菜單的二級菜單時隱藏當前三級菜單 $('.two_li').mouseleave(function(){ $(this).find('.three').slideUp(500) }) }) </script> </head> <body> <div> <ul> <li>首頁</li> <li>產(chǎn)品示例 <ul> <li>產(chǎn)品示例1</li> <li>產(chǎn)品示例2</li> <li>產(chǎn)品示例3 <ul> <li>產(chǎn)品示例3.1</li> <li>產(chǎn)品示例3.2</li> <li>產(chǎn)品示例3.3</li> <li>產(chǎn)品示例3.4</li> </ul> </li> <li>產(chǎn)品示例4</li> </ul> </li> <li>公司新聞 <ul> <li>公司新聞1 <ul> <li>公司新聞1.1</li> <li>公司新聞1.2</li> <li>公司新聞1.3</li> </ul> </li> <li>公司新聞2</li> <li>公司新聞3</li> </ul> </li> <li>服務支持</li> <li>聯(lián)系我們</li> </ul> </div> </body> </html>
Korrigierender Lehrer:查無此人Korrekturzeit:2019-03-18 09:29:06
Zusammenfassung des Lehrers:完成的不錯,js每行語句后面都增加;號。繼續(xù)加油。