Skip to content

[FR] Ability to hide footer on specific slides including title-slide #1445

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
cderv opened this issue Jul 18, 2022 · 3 comments · Fixed by #10695
Closed

[FR] Ability to hide footer on specific slides including title-slide #1445

cderv opened this issue Jul 18, 2022 · 3 comments · Fixed by #10695
Labels
enhancement New feature or request revealjs Issues with the revealjs format
Milestone

Comments

@cderv
Copy link
Collaborator

cderv commented Jul 18, 2022

Bug description

This relates to discussion in #825 and comment in #1391 (comment)

When a custom footer is set to

format: 
  revealjs:
    footer: Custom footer

It is possible to hide it on a specific slide using the trick of inserting an empty slide footer

# Slide 2

content 

::: footer
:::

However, this does not work on first slide at first

---
format: 
  revealjs:
    footer: Custom footer
---

# Slide 1 

content

::: footer
:::

# Slide 2

content 

This is because the feature (or free riding feature) rely on the per side footer overwrite using a slidechanged event which does not happen when presentation is loaded first time

deck.on("slidechanged", function (ev) {
const prevSlideFooter = document.querySelector(
".reveal > .footer:not(.footer-default)"
);
if (prevSlideFooter) {
prevSlideFooter.remove();
}
const currentSlideFooter = ev.currentSlide.querySelector(".footer");
if (currentSlideFooter) {
defaultFooterDiv.style.display = "none";
const slideFooter = currentSlideFooter.cloneNode(true);
handleLinkClickEvents(deck, slideFooter);
deck.getRevealElement().appendChild(slideFooter);
} else {
defaultFooterDiv.style.display = "block";
}
});

This means that in the example above if you go to slide 2 then back to slide 1, it will hide the footer.

Hiding footer on title slide can be useful when you want to do a custom one like in #1391 (comment) example (https://github.com/giabaio/quarto-slides/blob/main/assets/title-slide.qmd)

Having a real mechanism to hide a footer (like adding .no-footer class on a slide maybe ?) would be a plus

@cderv cderv added the bug Something isn't working label Jul 18, 2022
@giabaio
Copy link
Contributor

giabaio commented Jul 18, 2022

Thanks @cderv 👍

@dragonstyle dragonstyle added this to the Future milestone Jul 19, 2022
@mcanouil mcanouil added revealjs Issues with the revealjs format enhancement New feature or request and removed bug Something isn't working labels Jun 8, 2023
@mcanouil
Copy link
Collaborator

FYI

  • to hide the slide menu button on title slide:
include-after-body:
  - text: |
      <script type="text/javascript">
      Reveal.addEventListener('ready', (event) => {
        if (event.indexh === 0) {
          document.querySelector("div.slide-menu-button").style.display = "none";
        } else {
          document.querySelector("div.slide-menu-button").style.display = "block";
        }
      });
      Reveal.addEventListener('slidechanged', (event) => {
        if (event.indexh === 0) {
          document.querySelector("div.slide-menu-button").style.display = "none";
        } else {
          document.querySelector("div.slide-menu-button").style.display = "block";
        }
      });
      </script>
  • to hide only the slide number on title slide
/*-- scss:rules --*/

.reveal .slide-number > a[href*='title-slide'] {
  display: none;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request revealjs Issues with the revealjs format
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants