最新文章专题视频专题问答1问答10问答100问答1000问答2000关键字专题1关键字专题50关键字专题500关键字专题1500TAG最新视频文章推荐1 推荐3 推荐5 推荐7 推荐9 推荐11 推荐13 推荐15 推荐17 推荐19 推荐21 推荐23 推荐25 推荐27 推荐29 推荐31 推荐33 推荐35 推荐37视频文章20视频文章30视频文章40视频文章50视频文章60 视频文章70视频文章80视频文章90视频文章100视频文章120视频文章140 视频2关键字专题关键字专题tag2tag3文章专题文章专题2文章索引1文章索引2文章索引3文章索引4文章索引5123456789101112131415文章专题3
问答文章1 问答文章501 问答文章1001 问答文章1501 问答文章2001 问答文章2501 问答文章3001 问答文章3501 问答文章4001 问答文章4501 问答文章5001 问答文章5501 问答文章6001 问答文章6501 问答文章7001 问答文章7501 问答文章8001 问答文章8501 问答文章9001 问答文章9501
当前位置: 首页 - 科技 - 知识百科 - 正文

jQuery做出菜单导航栏功能

来源:懂视网 责编:小采 时间:2020-11-27 19:53:00
文档

jQuery做出菜单导航栏功能

jQuery做出菜单导航栏功能:<!DOCTYPE html> <html> <head> <metacharset="UTF-8"> <title></title> <style> *{ padding: 0px; margin: 0px; } #top{width: auto;height: 30px;background: #eee;position: relative;} #top li{floa
推荐度:
导读jQuery做出菜单导航栏功能:<!DOCTYPE html> <html> <head> <metacharset="UTF-8"> <title></title> <style> *{ padding: 0px; margin: 0px; } #top{width: auto;height: 30px;background: #eee;position: relative;} #top li{floa

<!DOCTYPE html>
<html>
 <head>
 <metacharset="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>
 <scripttype="text/javascript"src="js/jquery-1.8.3.js"></script>
 <script>
 $(function(){
 $(".li1").hover(function(){
 $(".shoucang").show();/*显示收藏的菜单内容*/
 $(".customer,.sell").hide();/*隐藏其他的菜单内容*/
 },function(){
 $(".shoucang").hide();/*鼠标离开,收藏的菜单内容隐藏*/
 });
 $(".li2").hover(function(){
 $(".sell").show();
 $(".customer,.shoucang").hide();
 },function(){
 $(".sell").hide();
 });
 $(".li3").hover(function(){
 $(".customer").show();
 $(".shoucang,.sell").hide();
 },function(){
 $(".customer").hide();
 });
 $("#top p").hover(function(){/*鼠标放置在p位置上,显示下拉菜单*/
 $(this).show();
 },function(){/*鼠标离开在p位置上,隐藏下拉菜单*/
 $(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>
 <pid="top">
 <ul>
 <liclass="li1">收藏夹</li>
 <liclass="li2">卖家中心</li>
 <liclass="li3">联系客服</li>
 
 </ul>
 <pclass="shoucang position">
 <p>收藏的宝贝</p>
 <p>收藏的店铺</p>
 </p>
 <pclass="sell position">
 <p>免费开店</p>
 <p>已出售的报宝贝</p>
 <p>出售中的报宝贝</p>
 <p>卖家服务市场</p>
 </p>
 <pclass="customer position">
 <p>消费者客服</p>
 <p>卖家客服</p>
 </p>
 </p>
 </body>
</html>

相信看了本文案例你已经掌握了方法,更多精彩请关注Gxl网其它相关文章!

推荐阅读:

jQuery操作输入框统计字数

jQuery表格顶栏固定效果

jquery插件扩展使用详解

声明:本网页内容旨在传播知识,若有侵权等问题请及时与本网联系,我们将在第一时间删除处理。TEL:177 7030 7066 E-MAIL:11247931@qq.com

本文如未解决您的问题请添加抖音号:51dongshi(抖音搜索懂视),直接咨询即可。

文档

jQuery做出菜单导航栏功能

jQuery做出菜单导航栏功能:<!DOCTYPE html> <html> <head> <metacharset="UTF-8"> <title></title> <style> *{ padding: 0px; margin: 0px; } #top{width: auto;height: 30px;background: #eee;position: relative;} #top li{floa
推荐度:
  • 热门焦点
专题
Top

抖音扫码关注

手机端二维码

每天分享百科知识!