1
Hello, I wonder if there is a possibility to give an ' if(element.Eventlistener('mouseover')... ' in Javascript!
I need to do the following action: When passing the mouse over the x element happens something and removing the mouse happens another.
Follow Javascript code
<script>
function effect () {
var element = document.getElementById('caracters');
if (element.addEventListener == true) {
document.getElementById('effect').style.animation = "effectload 2s infinite";
}else {
document.getElementById('effect').style.animation = "none";
}
}
document.getElementById('caracters').addEventListener('mouseover', () => effect());
</script>
Immediately, thank you for your help! :)
onmouseover object = function(){ logic };
– Vitor Ceolin
What is that
if
should do? What condition are you trying to verify?– Costamilam