Commit d21fcdb2 authored by Vadim Makeev's avatar Vadim Makeev

optional fullscreen detection

parent ad1c3298
...@@ -16,10 +16,18 @@ function enterFull() { ...@@ -16,10 +16,18 @@ function enterFull() {
updateView(); updateView();
} }
function exitFull(e) { function exitFull() {
if(e.which == 27) { fullscreen = false;
fullscreen = false; updateView();
updateView(); }
function toggleFull() {
if( window.fullScreen || // Firefox
document.webkitFullScreen || // Webkit
screen.width == window.outerWidth && screen.height == window.outerHeight ) {
enterFull();
} else {
exitFull();
} }
} }
...@@ -56,6 +64,12 @@ function updateView() { ...@@ -56,6 +64,12 @@ function updateView() {
if(fullscreen && !backhash[url.hash]) url.hash = slides[0]; if(fullscreen && !backhash[url.hash]) url.hash = slides[0];
} }
document.addEventListener('keyup', turnSlide, false);
domSlides[0].addEventListener('click', enterFull, false); domSlides[0].addEventListener('click', enterFull, false);
document.addEventListener('keyup', exitFull, false);
\ No newline at end of file window.addEventListener('DOMContentLoaded', toggleFull, false);
window.addEventListener('resize', toggleFull, false);
document.addEventListener('keyup', turnSlide, false);
document.addEventListener('keyup', function(e) {
if(e.which == 27) exitFull();
}, false);
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment