window.Config = { staticDir: '.' }; let isClose = true, header = $('.header'), heaerMenuGroup = $('.menu-group'), headerMask = $('.menu-mask'), headerMenuBtn = $('.btn-img'), currentRem = 0; let t1; function showMenu() { clearTimeout(t1); heaerMenuGroup.show().removeClass('iFadeOut').addClass('iFadeIn'); headerMask.show().removeClass('iFadeOut').addClass('iFadeIn'); headerMenuBtn.attr('src', window.Config.staticDir + '/images/guanbi.png'); $('body').css('overflow', 'hidden'); isClose = false; } function hideMenu() { heaerMenuGroup.removeClass('iFadeIn').addClass('iFadeOut'); headerMask.removeClass('iFadeIn').addClass('iFadeOut'); headerMenuBtn.attr('src', window.Config.staticDir + '/images/menu.png'); $('body').css('overflow', 'auto'); isClose = true; clearTimeout(t1); t1 = setTimeout(function () { heaerMenuGroup.hide(); headerMask.hide(); }, 1200); } $(function () { function getRem() { let windowWidth = window.innerWidth return windowWidth * (100 / (windowWidth > 768 ? 1920 : 750)); } function rszcal() { currentRem = getRem(); $('html').css('font-size', currentRem + "px"); } $(window).resize(rszcal); rszcal(); $('.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 > 4 * currentRem; } else { flag = t > 0.6 * currentRem; } if (flag) { header.removeClass('style1').addClass('style2'); } else { header.removeClass('style2').addClass('style1'); } }); header.on('click', '.menu-btn', function () { (isClose == true) ? showMenu() : 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 - (0.9 * currentRem), behavior: "smooth", }); }); new WOW().init(); });