Created
May 30, 2017 20:05
-
-
Save chrisjreber/54082db91b1d6ce9db3fcd86a870c192 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/************************** | |
* 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