JQuery hover to get <video> controls
JQuery hover to get <video> controls
by aflynt
HTML
<video width="300" height="auto" id="myvideo">
<source src="#" type="video/mp4" />
</video>
<video width="300" height="auto" id="video2">
<source src="#" type="video/mp4" />
</video>
<video width="300" height="auto" id="video3">
<source src="#" type="video/mp4" />
</video>
JavaScript
$('#myvideo, #video2, #video3').hover(function toggleControls() {
if (this.hasAttribute("controls")) {
this.removeAttribute("controls")
} else {
this.setAttribute("controls", "controls")
}
})