how to play music on hover a image ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

how to play music on hover a image ?

i have a task to create the music will be play when i hover a image, please help

14th Dec 2019, 6:35 AM
RianLauo
RianLauo - avatar
1 Answer
+ 5
var audio = new Audio('audio_file.mp3'); document.querySelector(".img1"). addEventListener ("mouseOver", function() { audio.play(); });
14th Dec 2019, 7:59 AM
Calviղ
Calviղ - avatar