There are a couple of problems with implementing the mouse leave functionality.
First, in the CSS the textfadein2 class has the same keyframes name as the textfadein class. It should be
.textfadein2{
animation: textfadein2 1s ease;
}
Second, when adding the textfadein class when the mouse moves into the element the textfadein2 class is not removed. As both classes are there, just the furthest down the cascade will be used. Try this:
shoe1.addEventListener('mouseenter', () =>{
text1.classList.add('textfadein');
text1.classList.remove('textfadein2');
});
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…