function removeTransition(e){ console.log(e.propertyName) // can do a condition based on a property or add a property using setProperty //example this.style.setProperty("background-color", 'blue'); // a a consition to if(e.propertyName !== 'transform') return this.classList.remove('playing'); } const keys = [...document.querySelectorAll('.key')]; //loop over all items clicked keys.forEach((key) => key.addEventListener('transitionend', removeTransition))
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