修改手机版菜单样式

This commit is contained in:
TOP糯米 2023-10-09 17:28:38 +08:00
parent 0c4fac833f
commit da1f7fc9fe
4 changed files with 91 additions and 35 deletions

View File

@ -1,8 +1,4 @@
<style> <style>
.header .menu .menu-mask {
background-image: url('images/transparent-bg.png');
}
.section.addrcont .aacont li::before { .section.addrcont .aacont li::before {
background-image: url('images/daohang.png'); background-image: url('images/daohang.png');
} }

View File

@ -1,3 +1,23 @@
@keyframes mobileHeaderFadeIn {
0% {
opacity: 0;
transform: translateY(-100%);
}
100% {
opacity: 0.9;
transform: translateY(0);
}
}
@keyframes mobileHeaderFadeOut {
0% {
opacity: 0.9;
transform: translateY(0);
}
100% {
opacity: 0;
transform: translateY(-100%);
}
}
@media screen and (max-width: 768px) { @media screen and (max-width: 768px) {
.pc { .pc {
display: none; display: none;
@ -30,6 +50,8 @@
color: #FFFFFF; color: #FFFFFF;
} }
.header .logo { .header .logo {
position: relative;
z-index: 10;
font-size: 0; font-size: 0;
} }
.header .logo img { .header .logo img {
@ -38,6 +60,14 @@
.header .main { .header .main {
height: 45px; height: 45px;
} }
.header .menu .menu-group.iFadeIn,
.header .menu .menu-mask.iFadeIn {
animation: mobileHeaderFadeIn 1.2s;
}
.header .menu .menu-group.iFadeOut,
.header .menu .menu-mask.iFadeOut {
animation: mobileHeaderFadeOut 1.2s;
}
.header .menu .menu-group { .header .menu .menu-group {
z-index: 10; z-index: 10;
display: none; display: none;
@ -45,7 +75,6 @@
left: 0; left: 0;
top: 45px; top: 45px;
right: 0; right: 0;
animation-duration: 0.2s;
} }
.header .menu .menu-mask { .header .menu .menu-mask {
z-index: 5; z-index: 5;
@ -55,7 +84,8 @@
left: 0; left: 0;
right: 0; right: 0;
bottom: 0; bottom: 0;
animation-duration: 0.35s; background-color: #000000;
opacity: 0.9;
} }
.header .menu .menu-btn { .header .menu .menu-btn {
z-index: 10; z-index: 10;
@ -67,20 +97,14 @@
} }
.header .menu .item { .header .menu .item {
margin-left: 0; margin-left: 0;
background-color: #C7001C;
padding: 0 18px; padding: 0 18px;
} }
.header .menu .item .link { .header .menu .item .link {
display: block; display: block;
box-sizing: border-box; box-sizing: border-box;
border-bottom: 2px solid #D02121; border-bottom: 1px solid #737373;
padding: 15px 0; padding: 13px 0;
} font-size: 16px;
.header .menu .item:first-child {
padding-top: 25px;
}
.header .menu .item:last-child {
padding-bottom: 40px;
} }
.footer .logo-bottom { .footer .logo-bottom {
max-height: 26px; max-height: 26px;

View File

@ -5,6 +5,30 @@
@st: 14px; @st: 14px;
@mst: 12px; @mst: 12px;
@keyframes mobileHeaderFadeIn {
0% {
opacity: 0;
transform: translateY(-100%);
}
100% {
opacity: 0.9;
transform: translateY(0);
}
}
@keyframes mobileHeaderFadeOut {
0% {
opacity: 0.9;
transform: translateY(0);
}
100% {
opacity: 0;
transform: translateY(-100%);
}
}
@media screen and (max-width: 768px) { @media screen and (max-width: 768px) {
.pc { .pc {
display: none; display: none;
@ -55,6 +79,8 @@
.header { .header {
.logo { .logo {
position: relative;
z-index: 10;
font-size: 0; font-size: 0;
img { img {
@ -67,6 +93,17 @@
} }
.menu { .menu {
.menu-group.iFadeIn,
.menu-mask.iFadeIn {
animation: mobileHeaderFadeIn 1.2s;
}
.menu-group.iFadeOut,
.menu-mask.iFadeOut {
animation: mobileHeaderFadeOut 1.2s;
}
.menu-group { .menu-group {
z-index: 10; z-index: 10;
display: none; display: none;
@ -74,7 +111,6 @@
left: 0; left: 0;
top: 45px; top: 45px;
right: 0; right: 0;
animation-duration: 0.2s;
} }
.menu-mask { .menu-mask {
@ -85,7 +121,8 @@
left: 0; left: 0;
right: 0; right: 0;
bottom: 0; bottom: 0;
animation-duration: 0.35s; background-color: #000000;
opacity: 0.9;
} }
.menu-btn { .menu-btn {
@ -100,24 +137,16 @@
.item { .item {
margin-left: 0; margin-left: 0;
background-color: #C7001C;
padding: 0 18px; padding: 0 18px;
.link { .link {
display: block; display: block;
box-sizing: border-box; box-sizing: border-box;
border-bottom: 2px solid #D02121; border-bottom: 1px solid #737373;
padding: 15px 0; padding: 13px 0;
font-size: 16px;
} }
} }
.item:first-child {
padding-top: 25px;
}
.item:last-child {
padding-bottom: 40px;
}
} }
} }

View File

@ -8,18 +8,28 @@ let isClose = true,
headerMask = $('.menu-mask'), headerMask = $('.menu-mask'),
headerMenuBtn = $('.btn-img'); headerMenuBtn = $('.btn-img');
let t1;
function showMenu() { function showMenu() {
heaerMenuGroup.show().addClass('fadeIn'); clearTimeout(t1);
headerMask.show().addClass('fadeIn'); heaerMenuGroup.show().removeClass('iFadeOut').addClass('iFadeIn');
headerMask.show().removeClass('iFadeOut').addClass('iFadeIn');
headerMenuBtn.attr('src', window.Config.staticDir + '/images/guanbi.png'); headerMenuBtn.attr('src', window.Config.staticDir + '/images/guanbi.png');
$('body').css('overflow', 'hidden');
isClose = false; isClose = false;
} }
function hideMenu() { function hideMenu() {
heaerMenuGroup.removeClass('fadeIn').hide(); heaerMenuGroup.removeClass('iFadeIn').addClass('iFadeOut');
headerMask.removeClass('fadeIn').hide(); headerMask.removeClass('iFadeIn').addClass('iFadeOut');
headerMenuBtn.attr('src', window.Config.staticDir + '/images/menu.png'); headerMenuBtn.attr('src', window.Config.staticDir + '/images/menu.png');
$('body').css('overflow', 'auto');
isClose = true; isClose = true;
clearTimeout(t1);
t1 = setTimeout(function () {
heaerMenuGroup.hide();
headerMask.hide();
}, 1200);
} }
$(function () { $(function () {
@ -41,9 +51,6 @@ $(function () {
header.on('click', '.menu-btn', function () { header.on('click', '.menu-btn', function () {
(isClose == true) ? showMenu() : hideMenu(); (isClose == true) ? showMenu() : hideMenu();
}); });
header.on('click', '.menu-mask', function () {
hideMenu();
});
$('.business-nav a').click(function (event) { $('.business-nav a').click(function (event) {
$('.business-nav a').removeClass('active'); $('.business-nav a').removeClass('active');
$(this).addClass('active'); $(this).addClass('active');