Когда знаешь как setTimeout работает в Javascript 😁
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
let header = document.querySelector('.header'); let elem = document.querySelector('.elem'); setTimeout(() => header.style.opacity = '0', 1000); setTimeout(() => header.style.opacity = '0.15', 1100); setTimeout(() => header.style.opacity = '0.2', 1200); setTimeout(() => header.style.opacity = '0.25', 1300); setTimeout(() => header.style.opacity = '0.3', 1400); setTimeout(() => header.style.opacity = '0.35', 1500); setTimeout(() => header.style.opacity = '0.4', 1600); setTimeout(() => header.style.opacity = '0.45', 1700); setTimeout(() => header.style.opacity = '0.5', 1800); setTimeout(() => header.style.opacity = '0.55', 1900); setTimeout(() => header.style.opacity = '0.6', 2000); setTimeout(() => header.style.opacity = '0.65', 2100); setTimeout(() => header.style.opacity = '0.7', 2200); setTimeout(() => header.style.opacity = '0.8', 2300); setTimeout(() => header.style.opacity = '0.9', 2400); setTimeout(() => header.style.opacity = '1', 2500); |