mouseover to start video in javascript code example

Example: 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();
    }
}

Tags:

Html Example