diff options
[presentation] Added an anchor to the current slide, which also shows slide index, in controls
1 files changed, 8 insertions, 0 deletions
| -rw-r--r-- | src/scripts/presentation.js | 8 |
diff --git a/src/scripts/presentation.js b/src/scripts/presentation.js index 8c78ed8..930c7b0 100644 --- a/src/scripts/presentation.js +++ b/src/scripts/presentation.js @@ -17,6 +17,7 @@ printBtn.addEventListener('click', function() { /* Next and previous buttons */ const prevSlideBtn = document.getElementById('prevSlideBtn'); +const slideIndexShow = document.getElementById('slideIndex'); const nextSlideBtn = document.getElementById('nextSlideBtn'); const slides = document.getElementsByClassName('slide'); @@ -24,6 +25,9 @@ var presenting = false; var slideIndex = parseInt(document.URL.substr(document.URL.indexOf("#slide") + 7)); if (isNaN(slideIndex)) slideIndex = 0; +slideIndexShow.innerText = slideIndex; +slideIndexShow.href = '#slide-' + slideIndex; + // Shows the "slideIndex + mod" numbered slide function showSlide(mod) { if (!presenting) return; @@ -31,6 +35,9 @@ function showSlide(mod) { slides[slideIndex].classList.remove('absolute-slide'); slideIndex = (slides.length + slideIndex + mod) % slides.length; slides[slideIndex].classList.add('absolute-slide'); + + slideIndexShow.innerText = slideIndex; + slideIndexShow.href = '#slide-' + slideIndex; } prevSlideBtn.addEventListener('click', function() { @@ -59,6 +66,7 @@ presentBtn.addEventListener('click', function() { // Show the slide controller presentCont.classList.toggle('absolute-cont'); prevSlideBtn.classList.toggle('nodisplay'); + slideIndexShow.classList.toggle('nodisplay'); nextSlideBtn.classList.toggle('nodisplay'); articleBtn.classList.toggle('nodisplay'); printBtn.classList.toggle('nodisplay'); |