0

Listen for mouse over, change class

I’m trying to work out a way to 1. Look for a class 2. Add an event listener on that class 3. When the mouse enters the div, toggle a new class? I’ve tried many varied ways, none successful! The below feels to be the closest. However, I either trigger an error that class Is null, or that the class EventListener Is not a function? My current code is: function animateCSS(changeClass, animationName, callback) { document.querySelectorAll(‘div.project’) changeClass.classList.toggle('fadeIn') function handleAnimationEnd() { changeClass.classList.remove('fadeIn') changeClass.removeEventListener('animationend', handleAnimationEnd) if (typeof callback === 'function') callback() } changeClass.addEventListener('animationend', handleAnimationEnd) }

6th Aug 2019, 9:04 PM
Grant Smith
Grant Smith - avatar
1 Respuesta
0
Are you still looking for an answer or youve found one elsewhere ?
20th May 2020, 11:23 PM
Kiro Cosmos
Kiro Cosmos - avatar