diff options
| Commit | 7153ef6f122a66bc74d95ebe04810e022e1ed5f1 (patch) | |
|---|---|---|
| Author | 2023-03-03 11:46:51 +0200 | |
| Committer | 2023-03-03 11:46:51 +0200 | |
| Files | fa7766de54a3a9465a8813d0649165fed4b3001b /src/scripts | |
| syndamia.com-7153ef6f122a66bc74d95ebe04810e022e1ed5f1.tar syndamia.com-7153ef6f122a66bc74d95ebe04810e022e1ed5f1.tar.gz syndamia.com-7153ef6f122a66bc74d95ebe04810e022e1ed5f1.zip | ||
| Parent | ed6f6af8dbb0da9018a5ed471394d4fb2d04d7c9 (diff) | |
[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'); |