jQuery實現(xiàn)菜單欄導航效果
更新時間:2017年08月15日 09:13:17 作者:顧白的顧小白
這篇文章主要為大家詳細介紹了jQuery實現(xiàn)簡單菜單欄導航效果,具有一定的參考價值,感興趣的小伙伴們可以參考一下
本文實例為大家分享了jQuery實現(xiàn)菜單欄導航效果的具體代碼,供大家參考,具體內(nèi)容如下
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title></title> <style> *{ padding: 0px; margin: 0px; } #top{width: auto;height: 30px;background: #eee;position: relative;} #top li{float: left; text-align: center; width: 80px; height:30px; line-height:30px; list-style: none; } /*設置位置*/ .position{ position: absolute; border: 1px solid #ccc; top:30px; padding: 3px; font-size: 15px; display: none; } .shoucang{width: auto;left: 10px;} .sell{width: auto;left: 70px;} .customer{width: auto;left: 180px;} .bg{background-color: #DDA0DD;cursor: pointer;} </style> <script type="text/javascript" src="js/jquery-1.8.3.js" ></script> <script> $(function(){ $(".li1").hover(function(){ $(".shoucang").show();/*顯示收藏的菜單內(nèi)容*/ $(".customer,.sell").hide();/*隱藏其他的菜單內(nèi)容*/ },function(){ $(".shoucang").hide();/*鼠標離開,收藏的菜單內(nèi)容隱藏*/ }); $(".li2").hover(function(){ $(".sell").show(); $(".customer,.shoucang").hide(); },function(){ $(".sell").hide(); }); $(".li3").hover(function(){ $(".customer").show(); $(".shoucang,.sell").hide(); },function(){ $(".customer").hide(); }); $("#top div").hover(function(){/*鼠標放置在div位置上,顯示下拉菜單*/ $(this).show(); },function(){/*鼠標離開在div位置上,隱藏下拉菜單*/ $(this).hide(); }); $(".sell p,.shoucang p,.customer p").bind("mouseover",function(){ $(this).addClass("bg"); }); $(".sell p,.shoucang p,.customer p").bind("mouseout",function(){ $(this).removeClass("bg"); }); }); </script> </head> <body> <div id="top"> <ul> <li class="li1">收藏夾</li> <li class="li2">賣家中心</li> <li class="li3">聯(lián)系客服</li> </ul> <div class="shoucang position"> <p>收藏的寶貝</p> <p>收藏的店鋪</p> </div> <div class="sell position"> <p>免費開店</p> <p>已出售的報寶貝</p> <p>出售中的報寶貝</p> <p>賣家服務市場</p> </div> <div class="customer position"> <p>消費者客服</p> <p>賣家客服</p> </div> </div> </body> </html>
以上就是本文的全部內(nèi)容,希望對大家的學習有所幫助,也希望大家多多支持腳本之家。
相關文章
jquery.validate自定義驗證用法實例分析【成功提示與擇要提示】
這篇文章主要介紹了jquery.validate自定義驗證用法,結合實例形式分析了jQuery成功提示與擇要提示驗證操作相關實現(xiàn)與使用技巧,需要的朋友可以參考下2020-06-06