$(function(){ var href = location.pathname + location.search; $('.e_loop-84 .p_loopitem').find('a').each(function (index, ele) {//二级当前导航展开 var href_yi = $(ele).attr('href'); //console.log(href_yi); if (href_yi == href) { $(ele).parents('.p_loopitem').addClass('active').siblings('.p_loopitem').removeClass('active')//一级导航加高亮 } }) })