pages/js/index.js
2017-10-29 11:13:00 -12:00

34 lines
1 KiB
JavaScript

// Set up fullscreen buttons (used on pages with embedded games)
function fullscreen() {
// check if fullscreen mode is available
if (document.fullscreenEnabled ||
document.webkitFullscreenEnabled ||
document.mozFullScreenEnabled ||
document.msFullscreenEnabled) {
// which element will be fullscreen
var iframe = document.getElementById('embed');
// Do fullscreen
if (iframe.requestFullscreen) {
iframe.requestFullscreen();
} else if (iframe.webkitRequestFullscreen) {
iframe.webkitRequestFullscreen();
} else if (iframe.mozRequestFullScreen) {
iframe.mozRequestFullScreen();
} else if (iframe.msRequestFullscreen) {
iframe.msRequestFullscreen();
}
iframe.contentWindow.focus();
}
else {
console.log('Your browser is not supported');
}
}
let btn = document.getElementById('fullscreenBtn')
if (btn) btn.addEventListener('click', fullscreen)
// Setup Carousel (used on homepage)
$(document).ready(function(){
$('.carousel.carousel-slider').carousel({full_width: true});
});