Skip to content

Instantly share code, notes, and snippets.

@bennettscience
Created September 19, 2016 14:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bennettscience/c5611aa6f180ef363819f51fc72550ac to your computer and use it in GitHub Desktop.
Save bennettscience/c5611aa6f180ef363819f51fc72550ac to your computer and use it in GitHub Desktop.
JS Source files for the church mission wall project
// Listen for user input and display a prompt if none for 30 seconds.
$(document).ready(function() {
var i = null;
$("#body-wrap").mousemove(function() {
clearTimeout(i);
$("#overlay").fadeOut();
i = setTimeout(function() {
$("#overlay").fadeIn();
}, 20000);
})
})
// Controls video display and playback
$(document).ready(function() {
// Listen for a click on a mission & play the video
$('.cell').on('click', function() {
var element = this.getElementsByTagName('video');
var m = element[0].getAttribute('id');
console.log(m);
var v = document.getElementById(m);
if (v.webkitRequestFullscreen) {
v.className = "";
v.webkitRequestFullscreen();
}
$("#" + m).on("ended", function() {
this.webkitExitFullscreen();
this.className = "hide";
});
// Detect fullscreen entered or exited for play state
$("#" + m).bind('webkitfullscreenchange', function(e) {
var state = document.webkitIsFullScreen;
var event = state ? 'FullscreenOn' : 'FullscreenOff';
if (event == 'FullscreenOn') {
console.log('entered fullscreen, playing...')
setTimeout(function() {v.play()},2000);
} else {
console.log('exited fullscreen, pausing...')
this.className = "hide";
v.pause();
}
});
})
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment