$(function(){ let windname = window.location.pathname; let time = setinterval(function () { let m = $(".p_loopitem a").attr("href"); if (m) { console.log(m); $(".p_loopitem a").each(function () { let l_m = $(this).attr("href") if (l_m == windname) { $(this).parents('.p_loopitem').addclass("active") } }); clearinterval(time); } }, 100); $('.categoryarr').click(function(){ $(this).parent().next().next('.openthismenu').animate({ height:'toggle' }); }); });