Error with exit button | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Error with exit button

hello everyone, going straight to the point, when I place the mouse over the svg, the correct thing would be the text appear, but it doesn't. I would like to know the solution, thanks :) https://code.sololearn.com/W6cN1eNPyNiR/?ref=app

28th Sep 2020, 6:05 PM
João Hoffman
João Hoffman - avatar
1 Answer
+ 1
Change your JavaScript to: var exit = document.getElementById("exitA"); var exitB = document.querySelector(".exitButton"); exitB.onmouseover = function(){ exit.style.transform = "translateX(0)"; } exitB.onmouseout = function(){ exit.style.transform = ""; } I made the text disappear when moving the cursor away. If you don't like that, just remove the onmouseout code. Something like that can be achieved with CSS and a :hover selector. The following CSS will cause the hover to toggle like the JavaScript above does: .exitBox:hover #exitA { transform: translateX(0); }
29th Sep 2020, 12:27 AM
Josh Greig
Josh Greig - avatar