(function () { // header callback var callBack = function () { var index = $('#index').attr('links') var service = $('#service').attr('links') var article = $('#article').attr('links') var patient = $('#patient').attr('links') var about = $('#about').attr('links') var join = $('#join').attr('links') var currentPage = window.location.href.slice(window.location.href.lastIndexOf('/') + 1, window.location.href.lastIndexOf('.')) console.log(currentPage) if (!currentPage) return $('#index').addClass('active') if (index && index.indexOf(currentPage) > -1) { $('#index').addClass('active') } if (service && service.indexOf(currentPage) > -1) { $('#service').addClass('active') } if (article && article.indexOf(currentPage) > -1) { $('#article').addClass('active') } if (patient && patient.indexOf(currentPage) > -1) { $('#patient').addClass('active') } if (about && about.indexOf(currentPage) > -1) { $('#about').addClass('active') } if (join && join.indexOf(currentPage) > -1) { $('#join').addClass('active') } } //// 鍔犺浇澶撮儴 //$('.header').load('../commonLayout/header.html', callBack) //$('footer').load('../commonLayout/footer.html') })() $(window).scroll(function () { if ($(document).scrollTop() >= 1) { $('#header').addClass('scrolling'); } else { $('#header').removeClass('scrolling'); } });