window.Config = { staticDir: '.' }; let isClose = true, header = $('.header'), heaerMenuGroup = $('.menu-group'), headerMask = $('.menu-mask'), headerMenuBtn = $('.btn-img'); function showMenu() { heaerMenuGroup.show().addClass('fadeIn'); headerMask.show().addClass('fadeIn'); headerMenuBtn.attr('src', window.Config.staticDir + '/images/guanbi.png'); isClose = false; } function hideMenu() { heaerMenuGroup.removeClass('fadeIn').hide(); headerMask.removeClass('fadeIn').hide(); headerMenuBtn.attr('src', window.Config.staticDir + '/images/menu.png'); isClose = true; } $(function () { $('.header .menu-group').load('../common/header.html'); $('.footer').load('../common/footer.html'); $(window).scroll(function () { let t = $(document).scrollTop(), flag; if ($(window).width() > 768) { flag = t > 400; } else { flag = t > 60; } if (flag) { header.removeClass('style1').addClass('style2'); } else { header.removeClass('style2').addClass('style1'); } }); header.on('click', '.menu-btn', function () { (isClose == true) ? showMenu() : hideMenu(); }); header.on('click', '.menu-mask', function () { hideMenu(); }); $('.business-nav a').click(function (event) { $('.business-nav a').removeClass('active'); $(this).addClass('active'); event.preventDefault(); let id = $(this).attr('href'); let ot = $(id)[0].offsetTop; window.scrollTo({ top: ot - 90, behavior: "smooth", }); }); new WOW().init(); });