window.Config = { staticDir: ".", }; let isClose = true, header = $('.header'), heaerMenuGroup = $('.menu-group'), headerMask = $('.menu-mask'), headerMenuBtn = $('.btn-img'), headerBg = header.css('background-image'); function showMenu() { heaerMenuGroup.show().addClass('fadeIn'); headerMask.show().addClass('fadeIn'); headerMenuBtn.attr('src', window.Config.staticDir + '/images/guanbi.png'); header.css({ 'background-image': 'url(\'' + window.Config.staticDir + '/images/transparent-bg.png\')' }); isClose = false; } function hideMenu() { heaerMenuGroup.removeClass('fadeIn').hide(); headerMask.removeClass('fadeIn').hide(); headerMenuBtn.attr('src', window.Config.staticDir + '/images/menu.png'); header.css({ 'background-image': headerBg }); isClose = true; } $(function () { $('.header .menu-group').load('/common/header.html'); $('.footer').load('/common/footer.html'); // if ($(window).width() > 768) { // let headerBg = header.css('background-image'); // $(window).scroll(function () { // let t = $(document).scrollTop(); // if (t > 430) { // header.css({ // 'background-image': "url('/static/module/index/zxf/images/transparent-bg.png')" // }); // } else { // header.css({ // 'background-image': headerBg // }); // } // }); // } 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(); });