zxf/js/main.js

69 lines
2.0 KiB
JavaScript
Raw Normal View History

2023-10-08 21:48:47 +08:00
window.Config = {
staticDir: ".",
};
let isClose = true,
header = $('.header'),
heaerMenuGroup = $('.menu-group'),
headerMask = $('.menu-mask'),
headerMenuBtn = $('.btn-img'),
headerBg = header.css('background-image');
2023-10-04 17:06:26 +08:00
function showMenu() {
2023-10-08 21:48:47 +08:00
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\')'
});
2023-10-04 17:06:26 +08:00
isClose = false;
}
function hideMenu() {
2023-10-08 21:48:47 +08:00
heaerMenuGroup.removeClass('fadeIn').hide();
headerMask.removeClass('fadeIn').hide();
headerMenuBtn.attr('src', window.Config.staticDir + '/images/menu.png');
header.css({
'background-image': headerBg
});
2023-10-04 17:06:26 +08:00
isClose = true;
}
2023-09-26 17:55:52 +08:00
$(function () {
2023-10-08 21:48:47 +08:00
$('.header .menu-group').load('/common/header.html');
2023-09-28 17:06:54 +08:00
$('.footer').load('/common/footer.html');
2023-10-08 21:48:47 +08:00
// 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 () {
2023-10-04 17:06:26 +08:00
(isClose == true) ? showMenu() : hideMenu();
});
2023-10-08 21:48:47 +08:00
header.on('click', '.menu-mask', function () {
2023-10-04 17:06:26 +08:00
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({
top: ot - 90,
behavior: "smooth",
});
});
2023-10-04 17:06:26 +08:00
2023-09-27 00:33:44 +08:00
new WOW().init();
2023-10-08 21:48:47 +08:00
});