Skip to content
Permalink
b44930c0a3
Switch branches/tags
Go to file
 
 
Cannot retrieve contributors at this time
23 lines (20 sloc) 652 Bytes
<script>
const availableSlides = [...document.querySelectorAll('section[id]')].map((element) => '#' + element.id);
availableSlides.unshift('#');
function goToSlide(number) {
if (availableSlides[number]) {
location = availableSlides[number];
}
}
document.addEventListener('keydown', function(event) {
const currentSlide = availableSlides.findIndex((availableSlide) => availableSlide === (location.hash || '#'));
switch (event.key) {
case 'ArrowLeft':
goToSlide(currentSlide - 1);
break;
case 'ArrowRight':
goToSlide(currentSlide + 1);
break;
}
});
</script>