首页 > 其他 > 详细

导航高亮

时间:2016-04-27 22:40:49      阅读:379      评论:0      收藏:0      [点我收藏+]

http://www.cnblogs.com/Dtscal/p/acv.html

 

 

if(nowUrl == ctx+"/center/personal/index.xhtml" || nowUrl == ctx+"/center/school/index.xhtml" || nowUrl == ctx+"/center/company/index.xhtml" ){
				//首页高亮
				$("#indexMenu").addClass("hover1");
			}else{
				$("a").each(function(){
					var getUrl = $(this).attr("href");
					if(getUrl == nowUrl ){
						var menuId= $(this).attr("data-fatherId");
						if(menuId){
							$("#"+menuId).addClass("hover1");
							return false;
						}
						
					}
				})
			}

var urlstr = location.href;    //获取浏览器的url
 var urlstatus=false;        //标记
 //遍历导航div
 $("#menu a").each(function () {
//判断导航里面的rel和url地址是否相等
  if ((urlstr + /).indexOf($(this).attr(rel)) > -1&&$(this).attr(rel)!=‘‘) {
   $(this).addClass(cur); urlstatus = true;
  } else {
   $(this).removeClass(cur);
  }
 });
//当前样式保持
 if (!urlstatus) {$("#menu a").eq(0).addClass(cur); }

明天来完善



导航高亮

原文:http://www.cnblogs.com/hupan508/p/5440466.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!