Skip to content
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

Is it possible to hide the Menu's button? #74

Open
jamespascoe opened this issue Mar 1, 2021 · 2 comments
Open

Is it possible to hide the Menu's button? #74

jamespascoe opened this issue Mar 1, 2021 · 2 comments

Comments

@jamespascoe
Copy link

Hi there,

Apologies if this has been answered elsewhere, but is it possible to hide the menu's hamburger button on an individual slide? I am giving a talk at a conference that has asked me to use a particular title slide - the idea being that all of the talks start with a uniform look-and-feel. Because of this, I would like to be able to hide the menu's button (on the title slide) and then have the button appear on all of the other slides.

I noticed that I can use the 'delayInit' configuration parameter to prevent the menu from initialising when the presentation loads. Then, once the user has advanced beyond the title slide, I can call 'initialiseMenu()' to start the menu plugin from that point onwards. This works fine, except that once the Menu has been initialised, if I go back to the title slide, the icon is present. Is there a good way to hide (and unhide) the menu's button?

Many thanks and take care,

Jim

@adgaudio
Copy link

My comment is 22 days late, so you've probably figured this out already. My solution is to create a css class and javascript callback:

  <section class="hide-menu-button"> test slide 2 </section>

and this javascript:

    Reveal.on( 'slidetransitionend', event => {
      var menubutton = document.getElementsByClassName("slide-menu-button")[0]
      // store default display setting
      if (typeof(menubutton.__stored_display) == "undefined") {
          menubutton.__stored_display = menubutton.style.display;
      }
      if (event.currentSlide.classList.contains("hide-menu-button")) {
        console.log("current slide hide");
          menubutton.style.display = 'none';
      } else if (event.previousSlide.classList.contains("hide-menu-button")) {
        console.log("current slide show");
        menubutton.style.display = menubutton.__stored_display;
      }
    });

@adgaudio
Copy link

For the above, I wonder if it makes sense to add it to the reveal.js-menu as a default option?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants