Answers for "open video on hover html"

0

html play video on hover

In HTML Document:
<video width='500' height='150'
       onmouseenter='VideoController(true, this)'
       onmouseleave='VideoController(false, this)'
       src="Videos/test.webm" loop>
  Your browser does not support the video tag.
</video>

In CSS:
const VideoController = function(isHovering, videoElement)
{
	if (isHovering == true)
    {
        videoElement.play();
    }
    else if (isHovering == false)
    {
        videoElement.pause();
    }
}
Posted by: Guest on April-08-2020

Browse Popular Code Answers by Language