0

how i can make an element hover with java script ? (not with mouse)

i mean i want to do an element hover with java script (in x and y) not with mouse , i want to make this with java script code

for example :

const element = document.querySelector("div");

setTimeout( ()=>{
  // heer i need some code to make div hover in x: 80px and y:20px
}, 4000 )
div{
height: 100px;
width:100px;
background-color:red;
}

div:hover{
background-color:blue;
}
<div>

</div>
Maik Lowrey
  • 10,972
  • 4
  • 14
  • 43
Alireza
  • 39
  • 2
  • 1
    Does this answer your question? [How do I simulate a mouseover in pure JavaScript that activates the CSS ":hover"?](https://stackoverflow.com/questions/17226676/how-do-i-simulate-a-mouseover-in-pure-javascript-that-activates-the-css-hover) – lusc Dec 19 '21 at 10:51

0 Answers0