// 设置导航栏样式 function setNavBar(el){ var style; var enter=function(e){ style = ``; $(this).attr('id','topNav'); let hidenEl = $(this).children('ol'); hidenEl.stop().slideDown() $(this).append(style) } var out = function(e){ $(this).removeAttr('id','topNav') $(this).children('ol').stop().slideUp() $('style').remove('.under-line') } el.mouseenter(enter); el.mouseleave(out); } // 搜索按钮 function searchButton(){ $('.search-box').mouseenter(function(){ $(this).stop().animate({ width:'160px' }) $('.search-box form').css({ border:'1px solid #fff' }) }) $('.search-box').mouseleave(function(){ let val = $('.search-box form .text')[0].value; console.log(val) if(!val){ $(this).stop().animate({ width:'24px' }).children('form').css({ border:'none' }) } }) } // $(function () { // var str1 =$(".path p a:last-child").text() // $(".left-nav>li").each(function(i){ // var e=String($(this).find("a").text()); // var s=RegExp(e); // if(s.exec(str1)){ // $(this).addClass("active"); // } // }) // })