//锚点缓动效果 $(function() { $('a[href*="#"]:not([href="#"])').click(function() { if (location.pathname.replace(/^\//, '') == this.pathname.replace(/^\//, '') && location.hostname == this.hostname) { var target = $(this.hash); target = target.length ? target : $('[name=' + this.hash.slice(1) + ']'); if (target.length) { $('html, body').animate({ scrollTop: target.offset().top - 100 }, 1000); return false; } } }); $("#w_grid-1609116919622").attr("onclick","location.href='/intro/1.html'"); $("#w_grid-1609116919630").attr("onclick","location.href='/intro/2.html'"); $("#w_grid-1609116919636").attr("onclick","location.href='/intro/3.html'"); $("#w_grid-1609116919643").attr("onclick","location.href='/intro/4.html'"); }); /*高亮*/ $(function() { var urlName = window.location.pathname; //获取地址栏中文件名或路径。 $('.NavList_a1 .more').each(function() { //遍历当前网页导航或分类 var urlHref = $(this).attr('href'); //获取导航链接地址href值 if (urlName.indexOf(urlHref)>=0) { //检测文件名或路径中是否包含当前链接值 $(this).addClass('active'); } }); });