DEV Community

Martin
Martin

Posted on

Hover to toggle between functions in JS

I've commented on the code:
https://hastebin.com/vafitayuwe.xml

Top comments (1)

Collapse
 
berniwittmann profile image
Bernhard Wittmann

I created a small fiddle to solve this: JSFiddle

The key is to add event listeners to the hover div for mouseover and mouseleave. So the corresponding functions are called upon hover or leaving the hover state.

If you have more questions, just let me know