页面跳转,给导航加高亮

  

var urlstr = location.href;

var urlstatus=false;
$("#navUl a").each(function () {
if ((urlstr + '/').indexOf($(this).attr('href')) > -1&&$(this).attr('href')!='') {
$(this).addClass('acd');$(this).parent().parent().parent().find('a').eq(0).addClass('acd'); urlstatus = true;
} else {
$(this).removeClass('acd');
}
});
if (!urlstatus) {$("#navUl a").eq(0).addClass('acd'); }
posted @ 2016-02-04 15:16  顾小骚  阅读(734)  评论(0)    收藏  举报