2023-10-08 21:48:47 +08:00
|
|
|
window.Config = {
|
2023-10-09 17:23:49 +08:00
|
|
|
staticDir: '.'
|
2023-10-08 21:48:47 +08:00
|
|
|
};
|
2023-10-09 17:23:49 +08:00
|
|
|
|
2023-10-08 21:48:47 +08:00
|
|
|
let isClose = true,
|
|
|
|
header = $('.header'),
|
|
|
|
heaerMenuGroup = $('.menu-group'),
|
|
|
|
headerMask = $('.menu-mask'),
|
2023-10-09 17:23:49 +08:00
|
|
|
headerMenuBtn = $('.btn-img');
|
2023-10-04 17:06:26 +08:00
|
|
|
|
2023-10-09 17:28:38 +08:00
|
|
|
let t1;
|
2023-10-04 17:06:26 +08:00
|
|
|
function showMenu() {
|
2023-10-09 17:28:38 +08:00
|
|
|
clearTimeout(t1);
|
|
|
|
heaerMenuGroup.show().removeClass('iFadeOut').addClass('iFadeIn');
|
|
|
|
headerMask.show().removeClass('iFadeOut').addClass('iFadeIn');
|
2023-10-08 21:48:47 +08:00
|
|
|
headerMenuBtn.attr('src', window.Config.staticDir + '/images/guanbi.png');
|
2023-10-09 17:28:38 +08:00
|
|
|
$('body').css('overflow', 'hidden');
|
2023-10-04 17:06:26 +08:00
|
|
|
isClose = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
function hideMenu() {
|
2023-10-09 17:28:38 +08:00
|
|
|
heaerMenuGroup.removeClass('iFadeIn').addClass('iFadeOut');
|
|
|
|
headerMask.removeClass('iFadeIn').addClass('iFadeOut');
|
2023-10-08 21:48:47 +08:00
|
|
|
headerMenuBtn.attr('src', window.Config.staticDir + '/images/menu.png');
|
2023-10-09 17:28:38 +08:00
|
|
|
$('body').css('overflow', 'auto');
|
2023-10-04 17:06:26 +08:00
|
|
|
isClose = true;
|
2023-10-09 17:28:38 +08:00
|
|
|
|
|
|
|
clearTimeout(t1);
|
|
|
|
t1 = setTimeout(function () {
|
|
|
|
heaerMenuGroup.hide();
|
|
|
|
headerMask.hide();
|
|
|
|
}, 1200);
|
2023-10-04 17:06:26 +08:00
|
|
|
}
|
|
|
|
|
2023-09-26 17:55:52 +08:00
|
|
|
$(function () {
|
2023-10-11 21:42:06 +08:00
|
|
|
function getRem() {
|
|
|
|
let windowWidth = window.innerWidth
|
|
|
|
return windowWidth * (100 / (windowWidth > 768 ? 1920 : 750));
|
|
|
|
}
|
|
|
|
function rszcal() {
|
|
|
|
$('html').css('font-size', getRem() + "px");
|
2023-10-11 19:46:21 +08:00
|
|
|
}
|
2023-10-11 21:42:06 +08:00
|
|
|
$(window).resize(rszcal);
|
|
|
|
rszcal();
|
|
|
|
let currentRem = getRem();
|
2023-10-11 19:46:21 +08:00
|
|
|
|
2023-10-09 17:23:49 +08:00
|
|
|
$('.header .menu-group').load('../common/header.html');
|
|
|
|
$('.footer').load('../common/footer.html');
|
|
|
|
$(window).scroll(function () {
|
|
|
|
let t = $(document).scrollTop(), flag;
|
|
|
|
if ($(window).width() > 768) {
|
2023-10-11 21:42:06 +08:00
|
|
|
flag = t > 4 * currentRem;
|
2023-10-09 17:23:49 +08:00
|
|
|
} else {
|
2023-10-11 21:42:06 +08:00
|
|
|
flag = t > 0.6 * currentRem;
|
2023-10-09 17:23:49 +08:00
|
|
|
}
|
|
|
|
if (flag) {
|
|
|
|
header.removeClass('style1').addClass('style2');
|
|
|
|
} else {
|
|
|
|
header.removeClass('style2').addClass('style1');
|
|
|
|
}
|
|
|
|
});
|
2023-10-08 21:48:47 +08:00
|
|
|
header.on('click', '.menu-btn', function () {
|
2023-10-04 17:06:26 +08:00
|
|
|
(isClose == true) ? showMenu() : hideMenu();
|
|
|
|
});
|
2023-10-08 21:48:47 +08:00
|
|
|
$('.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({
|
2023-10-11 21:42:06 +08:00
|
|
|
top: ot - (0.9 * currentRem),
|
2023-10-08 21:48:47 +08:00
|
|
|
behavior: "smooth",
|
|
|
|
});
|
|
|
|
});
|
2023-10-04 17:06:26 +08:00
|
|
|
|
2023-09-27 00:33:44 +08:00
|
|
|
new WOW().init();
|
2023-10-09 17:23:49 +08:00
|
|
|
});
|