首页 > 编程 > JavaScript > 正文

jQuery+css实现的蓝色水平二级导航菜单效果代码

2019-11-20 11:34:54
字体:
来源:转载
供稿:网友

本文实例讲述了jQuery+css实现的蓝色水平二级导航菜单效果。分享给大家供大家参考。具体如下:

这是一款蓝色经典的jQuery+CSS实现水平二级导航菜单,相信你会喜欢的,蓝色,超级经典的一种风格,从其它网站上扣下来的,我认为很不错,赶紧分享给大家吧。

运行效果截图如下:

在线演示地址如下:

http://demo.VeVB.COm/js/2015/js-css-blue-line-2level-nav-menu-codes/

具体代码如下:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=gb2312" /><title>蓝色水平二级导航菜单</title><style>*{ font-size:12px; font-family:Tahoma, Verdana, Arial, Helvetica, sans-serif;}body{ margin:0; padding:0; background:white;}img{ border:0;}a:link,a:visited,a:active{ text-decoration:none;}a:hover{ text-decoration:underline;}/********** header **********/.header{ width:100%; background:url(images/header_bg.gif) #ffffff repeat-x 0 0; text-align:center;}.header .padder{ width:910px; margin:0 auto; background:url(images/header_bg.gif) #ffffff repeat-x 0 0; padding-bottom:4px; text-align:left;}.header .padder .nav{ background:url(images/vertical.gif) repeat-x 0 -36px; height:36px;}.header .padder .navLeftBg{ background:urlvertical.gif) no-repeat 0 0; height:36px;}.header .padder .navRightBg{ background:url(images/icons.gif) no-repeat right -146px; height:36px;}.header .padder .nav .mainNav{ padding-left:24px; position:absolute;}.header .padder .nav .mainNav a:link,.header .padder .nav .mainNav a:visited,.header .padder .nav .mainNav a:active{ width:90px; height:36px; display:inline-block; text-align:center; color:#ffffff; font-weight:bold; font-size:14px; line-height:36px; margin-left:11px;}.header .padder .nav .mainNav a:hover{ text-decoration:none;}.header .padder .nav .mainNav a.actived:link,.header .padder .nav .mainNav a.actived:visited,.header .padder .nav .mainNav a.actived:hover,.header .padder .nav .mainNav a.actived:active{ background:url(images/icons.gif) no-repeat 0 -27px; color:#000000;}.header .padder .secondNav{ line-height:21px; text-align:left;}.header .padder .secondNav a{ color:#266392; display:inline-block; padding:0 8px; margin-right:19px;}.header .padder .secondNav a.actived{ font-weight:bold;}.header .padder .secondNav .subNav1{ display:none;}.header .padder .secondNav .subNav2{ padding-left:150px;display:none;}.header .padder .secondNav .subNav3{ padding-left:250px;display:none;}.header .padder .secondNav .subNav4{ padding-left:350px;display:none;}.header .padder .secondNav .subNav5{ padding-left:450px;display:none;}.header .padder .secondNav .subNav6{ padding-left:550px;display:none;}.header .padder .secondNav .subNav7{ padding-left:650px;display:none;}</style><script language="javascript" type="text/javascript" src="jquery1.3.2.js"></script><script language="javascript" type="text/javascript">$(document).ready(function(){ $(".mainNav a").mouseover(function(){  $(".mainNav a").attr("class","");  $("#"+this.id).attr("class","actived");  var currentMenuNo = parseInt(this.id.substring(1));  $(".secondNav div").each(function(){   $(this).hide();   $("#subNav"+currentMenuNo).show();  }); });});</script></head><body><div class="header"> <div class="padder">  <div class="nav">   <div class="navLaftBg">    <div class="navRightBg">     <div class="mainNav">      <a href="#" id="n1" class="actived">首页</a>      <a href="#" id="n2">ASP源码</a>      <a href="#" id="n3">PHP源码</a>      <a href="#" id="n4">.NET源码</a>      <a href="#" id="n5">HTML源码</a>      <a href="#" id="n6">工具软件</a>      <a href="#" id="n7">脚本源码</a>     </div>    </div>   </div>  </div>  <div class="secondNav">   <div id="subNav2" class="subNav2">    <a href="#" class="actived">社区论坛</a>    <a href="#">全站CMS</a>    <a href="#">企业网站</a>   </div>   <div id="subNav3" class="subNav3">    <a href="#" class="actived">社区论坛</a>    <a href="#">全站CMS</a>    <a href="#">企业网站</a>   </div>   <div id="subNav4" class="subNav4">    <a href="#" class="actived">社区论坛</a>    <a href="#">全站CMS</a>    <a href="#">企业网站</a>   </div>   <div id="subNav5" class="subNav5">    <a href="#" class="actived">社区论坛</a>    <a href="#">全站CMS</a>    <a href="#">企业网站</a>   </div>   <div id="subNav6" class="subNav6">    <a href="#" class="actived">社区论坛</a>    <a href="#">全站CMS</a>    <a href="#">企业网站</a>   </div>   <div id="subNav7" class="subNav7">    <a href="#" class="actived">社区论坛</a>    <a href="#">全站CMS</a>    <a href="#">企业网站</a>   </div>  </div> </div></div></body></html>

希望本文所述对大家的jquery程序设计有所帮助。

发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表