@keyframes menu-out-s { 0% { opacity: 1; -webkit-transform: translateY(0); transform: translateY(0); -webkit-animation-timing-function: cubic-bezier(.23, 1, .32, 1); animation-timing-function: cubic-bezier(.23, 1, .32, 1) } 100% { opacity: 0; -webkit-transform: translateY(40px); transform: translateY(40px); } } .header-menu:nth-of-type(1) { -webkit-animation: menu-in-s .4s linear 0s1 normal both; animation: menu-in-s .4s linear 0s1 normal both } .header-menu:nth-of-type(2) { -webkit-animation: menu-in-s .4s linear .05s1 normal both; animation: menu-in-s .4s linear .05s1 normal both } .header-menu:nth-of-type(3) { -webkit-animation: menu-in-s .4s linear .1s1 normal both; animation: menu-in-s .4s linear .1s1 normal both } .header-menu:nth-of-type(4) { -webkit-animation: menu-in-s .4s linear .15s1 normal both; animation: menu-in-s .4s linear .15s1 normal both } .header-menu:nth-of-type(5) { -webkit-animation: menu-in-s .4s linear .2s1 normal both; animation: menu-in-s .4s linear .2s1 normal both } .header-menu:nth-of-type(6) { -webkit-animation: menu-in-s .4s linear .25s1 normal both; animation: menu-in-s .4s linear .25s1 normal both } .header-menu:nth-of-type(7) { -webkit-animation: menu-in-s .4s linear .3s1 normal both; animation: menu-in-s .4s linear .3s1 normal both } .header-menu:nth-of-type(8) { -webkit-animation: menu-in-s .4s linear .35s1 normal both; animation: menu-in-s .4s linear .35s1 normal both } .header-menu:nth-of-type(9) { -webkit-animation: menu-in-s .4s linear .4s1 normal both; animation: menu-in-s .4s linear .4s1 normal both } .header-menu:nth-of-type(10) { -webkit-animation: menu-in-s .4s linear .45s1 normal both; animation: menu-in-s .4s linear .45s1 normal both }
.header-menu-fadeout:nth-of-type(1) { -webkit-animation: menu-out-s .4s linear .36s1 normal both; animation: menu-out-s .4s linear .36s1 normal both } .header-menu-fadeout:nth-of-type(2) { -webkit-animation: menu-out-s .4s linear .32s1 normal both; animation: menu-out-s .4s linear .32s1 normal both } .header-menu-fadeout:nth-of-type(3) { -webkit-animation: menu-out-s .4s linear .28s1 normal both; animation: menu-out-s .4s linear .28s1 normal both } .header-menu-fadeout:nth-of-type(4) { -webkit-animation: menu-out-s .4s linear .24s1 normal both; animation: menu-out-s .4s linear .24s1 normal both } .header-menu-fadeout:nth-of-type(5) { -webkit-animation: menu-out-s .4s linear .2s1 normal both; animation: menu-out-s .4s linear .2s1 normal both } .header-menu-fadeout:nth-of-type(6) { -webkit-animation: menu-out-s .4s linear .16s1 normal both; animation: menu-out-s .4s linear .16s1 normal both } .header-menu-fadeout:nth-of-type(7) { -webkit-animation: menu-out-s .4s linear .12s1 normal both; animation: menu-out-s .4s linear .12s1 normal both } .header-menu-fadeout:nth-of-type(8) { -webkit-animation: menu-out-s .4s linear .08s1 normal both; animation: menu-out-s .4s linear .08s1 normal both } .header-menu-fadeout:nth-of-type(9) { -webkit-animation: menu-out-s .4s linear .04s1 normal both; animation: menu-out-s .4s linear .04s1 normal both } .header-menu-fadeout:nth-of-type(10) { -webkit-animation: menu-out-s .4s linear 0s1 normal both; animation: menu-out-s .4s linear 0s1 normal both }
.header-menu-fadeout{ pointer-events: none; }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
document.getElementById('btn').addEventListener("click",function(){ document.querySelectorAll('.header-menu').forEach((el)=>{ var className = "header-menu-fadeout"; if (el.classList) { el.classList.toggle(className); } else { var classes = el.className.split(' '); var existingIndex = classes.indexOf(className);
if (existingIndex >= 0) classes.splice(existingIndex, 1); else classes.push(className);