//Menu Fade Animation const handleHover = function (e) { if (e.target.classList.contains('nav__link')) { const link = e.target; const siblings = link.closest('.nav').querySelectorAll('.nav__link'); const logo = link.closest('.nav').querySelector('img'); siblings.forEach(el => { if (el !== link) el.style.opacity = this; }); logo.style.opacity = this; } }; //Passing "argument" into handler nav.addEventListener('mouseover', handleHover.bind(0.5)); nav.addEventListener('mouseout', handleHover.bind(1));
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter