Skip to content

Instantly share code, notes, and snippets.

@chrisjreber
Created May 30, 2017 20:05
Show Gist options
  • Save chrisjreber/54082db91b1d6ce9db3fcd86a870c192 to your computer and use it in GitHub Desktop.
Save chrisjreber/54082db91b1d6ce9db3fcd86a870c192 to your computer and use it in GitHub Desktop.
/**************************
* Movie controls
*************************/
if($("#lens-video").length) {
var moviecontainer = document.getElementById("lens-video"),
movie = moviecontainer.querySelector("video"),
controls = moviecontainer.querySelector("span");
movie.removeAttribute("controls");
controls.style.display = "block";
$("#play-pause").on({
mouseenter: function() {
$('#play-pause span').toggle();
movie.play();
},
mouseleave: function() {
$('#play-pause span').toggle();
movie.pause();
}
});
$("#play-pause").on({
click: function() {
if(movie.paused) {
$('#play-pause span').hide();
movie.play();
} else {
$('#play-pause span').show();
movie.pause();
}
}
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment