jQuery實現(xiàn)二級導(dǎo)航菜單的示例
實用JQ實現(xiàn)導(dǎo)航二級菜單效果,導(dǎo)航菜單在網(wǎng)站中非常常見,有的網(wǎng)站可能會出現(xiàn)三級菜單及多級菜單模式,下面我們來簡單的實現(xiàn)一個二級菜單的效果。
部分效果截圖:
整體代碼:
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>導(dǎo)航菜單案例</title> <style> *{ padding: 0; margin: 0; } ul,li{ list-style: none; } a{ text-decoration: none; } nav{ width: 1140px; height: 40px; margin: 0 auto; border:solid 1px #CCC; position: relative; } nav ul li{ width: 150px; line-height: 40px; float: left; } nav ul li a{ display: block; width: 100%; float: left; color: #444; font-size: 14px; text-align: center; } nav>ul>li:hover{ background: #f5f5f5; } nav ul li ul{ display: none; width: 150px; position: absolute; background-color: #f5f5f5; overflow: hidden; top:41px; } nav ul li ul li{ float: left; border-bottom: solid 1px #CCC; } nav ul li ul li:last-child{ border: none; } nav>ul>li>ul>li:hover a{ background-color: #444; color: #FFF; } </style> </head> <body> <br /> <br /> <nav> <ul> <li><a href="" title=" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" 首頁">首頁</a></li> <li><a href="" title=" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" 聯(lián)系我們">聯(lián)系我們</a></li> <li><a href="" title=" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" 在線留言">在線留言</a></li> <li> <a href="" title=" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" 新聞資訊">新聞資訊</a> <ul> <li><a href="" title=" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" 國內(nèi)資訊">國內(nèi)資訊</a></li> <li><a href="" title=" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" 國內(nèi)資訊">國內(nèi)資訊</a></li> </ul> </li> <li> <a href="" title=" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" 產(chǎn)品中心">產(chǎn)品中心</a> <ul> <li><a href="" title=" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" 除雪機">除雪機</a></li> <li><a href="" title=" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" 運雪車">運雪車</a></li> </ul> </li> <li><a href="" title=" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" 案例展示">案例展示</a></li> </ul> </nav> <script src="https://code.jquery.com/jquery-3.4.1.min.js"></script> <script> var $li = $("nav > ul > li"); $li.mouseenter(function () { $(this).children("ul").stop().slideDown(); }); $li.mouseleave(function () { $(this).children("ul").stop().slideUp(); }); </script> </body> </html>
以上就是jQuery實現(xiàn)二級導(dǎo)航菜單的示例的詳細內(nèi)容,更多關(guān)于jQuery實現(xiàn)二級導(dǎo)航菜單的資料請關(guān)注腳本之家其它相關(guān)文章!
- jQuery實現(xiàn)簡單漂亮的Nav導(dǎo)航菜單效果
- jQuery和CSS仿京東仿淘寶列表導(dǎo)航菜單
- 基于jQuery實現(xiàn)火焰燈效果導(dǎo)航菜單
- jQuery縱向?qū)Ш讲藛涡Ч麑崿F(xiàn)方法
- jQuery+CSS3實現(xiàn)仿花瓣網(wǎng)固定頂部位置帶懸浮效果的導(dǎo)航菜單
- jQuery+css實現(xiàn)非常漂亮的水平導(dǎo)航菜單效果
- jQuery模仿京東/天貓商品左側(cè)分類導(dǎo)航菜單效果
- 原生js和jquery分別實現(xiàn)橫向?qū)Ш讲藛涡Ч?/a>
- jQuery+CSS實現(xiàn)一個側(cè)滑導(dǎo)航菜單代碼
- jquery實現(xiàn)具有收縮功能的垂直導(dǎo)航菜單
- 基于jQuery實現(xiàn)以手風(fēng)琴方式展開和折疊導(dǎo)航菜單
相關(guān)文章
jQuery Validation實例代碼 讓驗證變得如此容易
眾所周知,Jquery以其簡潔性讓無數(shù)人為之瘋狂。現(xiàn)在我要像大家介紹一個jQuery Validation,一看到Validation大家肯定第一直觀感覺就是這肯定是一個驗證框架,沒有錯,本文就是基于jQuery Validation展開討論。2010-10-10jquery dataTable 獲取某行數(shù)據(jù)
本篇文章主要介紹了jquery dataTable 獲取某行數(shù)據(jù)的相關(guān)知識,具有很好的參考價值。下面跟著小編一起來看下吧2017-05-05jquery ajax提交表單數(shù)據(jù)的兩種實現(xiàn)方法
貌似AJAX越來越火了,作為一個WEB程序開發(fā)者要是不會這個感覺就要落伍,甚至有可能在求職的時候?qū)冶惶蕴?。我也是一個WEB程序開發(fā)者,當(dāng)然我也要“隨波逐流”一把,不然飯碗不保啊!2010-04-04ASP.NET jQuery 實例3 (在TextBox里面阻止復(fù)制、剪切和粘貼事件)
在這講里,讓我們看下如何在ASP.NET Textbox里禁止復(fù)制、剪切和粘貼行為2012-01-01使用jquery.form.js實現(xiàn)圖片上傳的方法
這篇文章主要介紹了使用jquery.form.js實現(xiàn)圖片上傳的方法,涉及jquery使用表單插件jquery.form.js進行圖片上傳的提交、類型驗證、執(zhí)行結(jié)果回調(diào)顯示等技巧,非常簡單實用,需要的朋友可以參考下2016-05-05