You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

91 lines
2.6 KiB

<script>
$(document).ready(function () {
// ☜ ☝ ☞ ☟ ☆ ✠ ✡ ✢ ✣ ✤ ✥ ✦ ✧ ✩ ✪
// get all the "slides", hide them
$sections = $('section');
$sections.hide();
var section_number = 0;
var $cur_section = $( $sections.get(section_number) );
$cur_section.toggle(); // show first slide
var transit = function (jump) {
$('button').hide();
$cur_section.hide();
section_number += jump;
if (section_number > ($sections.length - 1)) {
section_number = 0;
}
$cur_section = $( $sections.get(section_number) );
$cur_section.toggle({
duration: 200,
done: function () { $('button').show(); }
});
};
var $fwd_button = $('<button class=clicker-button>next</button>');
var $bwd_button = $('<button class=clicker-button>prev</button>');
$fwd_button.click(function (e) {
e.preventDefault();
transit(1);
});
$bwd_button.click(function (e) {
e.preventDefault();
transit(-1);
});
$(document).keydown(function(e) {
switch(e.which) {
case 8: // backspace
case 37: // left
$bwd_button.click();
break;
case 32: // spacebar
case 39: // right
$fwd_button.click();
break;
case 90:
toggleFullScreen();
break;
default:
return;
}
e.preventDefault();
});
$button_group = $('<div class=buttons/>');
$button_group.append($bwd_button);
$button_group.append($fwd_button);
$('body').append($button_group);
var toggleFullScreen = function () {
if (!document.fullscreenElement && // alternative standard method
!document.mozFullScreenElement && !document.webkitFullscreenElement && !document.msFullscreenElement ) { // current working methods
if (document.documentElement.requestFullscreen) {
document.documentElement.requestFullscreen();
} else if (document.documentElement.msRequestFullscreen) {
document.documentElement.msRequestFullscreen();
} else if (document.documentElement.mozRequestFullScreen) {
document.documentElement.mozRequestFullScreen();
} else if (document.documentElement.webkitRequestFullscreen) {
document.documentElement.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT);
}
} else {
if (document.exitFullscreen) {
document.exitFullscreen();
} else if (document.msExitFullscreen) {
document.msExitFullscreen();
} else if (document.mozCancelFullScreen) {
document.mozCancelFullScreen();
} else if (document.webkitExitFullscreen) {
document.webkitExitFullscreen();
}
}
};
});
</script>
</body>
</html>