diff --git a/exampleSite/content/home/configuration.md b/exampleSite/content/home/configuration.md index 1d13e9b..91e043b 100644 --- a/exampleSite/content/home/configuration.md +++ b/exampleSite/content/home/configuration.md @@ -142,7 +142,7 @@ In `home/reveal-hugo/body.html`: ```html @@ -150,7 +150,7 @@ Reveal.addEventListener('slidechanged', function(event) { --- -### Extending the layout +### Extending the layout #### (alternative) You can declare a custom CSS or javascript in your configuration. @@ -163,7 +163,7 @@ custom_js = "js/custom.js" -These files can be located in `static/css`, `static/js` folder +These files can be located in `static/css`, `static/js` folder 💡 See the [extending layout example](/extending-layout-example/#) for more details. diff --git a/exampleSite/layouts/partials/home/reveal-hugo/body.html b/exampleSite/layouts/partials/home/reveal-hugo/body.html index 1dba7f9..1fa554e 100644 --- a/exampleSite/layouts/partials/home/reveal-hugo/body.html +++ b/exampleSite/layouts/partials/home/reveal-hugo/body.html @@ -3,7 +3,7 @@ diff --git a/exampleSite/static/plugin/gallery/gallery.plugin.js b/exampleSite/static/plugin/gallery/gallery.plugin.js index 355ae59..00ddd7e 100644 --- a/exampleSite/static/plugin/gallery/gallery.plugin.js +++ b/exampleSite/static/plugin/gallery/gallery.plugin.js @@ -1,6 +1,8 @@ (function(Gallery) { var galleryTimer, galleryMode; + Gallery.id = 'gallery'; + Gallery.step = function (items, iterations) { var length = items.length, ptr = 0, @@ -31,7 +33,7 @@ // FIXME remove dependency on Reveal, have a callback? function // that will get a root node to move full screen slides to (ie. slidesNode) - // for full screen mode we need to: + // for full screen mode we need to: // - take the gallery out of the flow and insert it before "slides" // - hide slides // - make it full screen @@ -94,15 +96,15 @@ })(window.Gallery = window.Gallery || {});(function() { if( typeof window.addEventListener === 'function' ) { var slidesNode = document.querySelector(".slides"); - Reveal.addEventListener("slidechanged", function (event) { + Reveal.on("slidechanged", function (event) { console.log(event) - var galleryNode = event.previousSlide.querySelector('.gallery') || document.querySelector('.reveal > .gallery'); + var galleryNode = event.previousSlide?.querySelector('.gallery') || document.querySelector('.reveal > .gallery'); if (galleryNode) { Gallery.stop(galleryNode, slidesNode); } galleryNode = event.currentSlide.querySelector('.gallery'); - if (galleryNode) { + if (galleryNode) { Gallery.start(galleryNode, slidesNode); } @@ -116,4 +118,4 @@ } } } -})(); \ No newline at end of file +})(); diff --git a/layouts/partials/layout/javascript.html b/layouts/partials/layout/javascript.html index 6b6c6f1..545e43f 100644 --- a/layouts/partials/layout/javascript.html +++ b/layouts/partials/layout/javascript.html @@ -84,8 +84,8 @@ // support current page reload with possible mermaid element render({currentSlide: Reveal.getCurrentSlide()}); - Reveal.addEventListener('slidechanged', render); - Reveal.addEventListener('ready', render); + Reveal.on('slidechanged', render); + Reveal.on('ready', render); {{ end }}