Skip to content

Question about hiding toolbar, title, and description for a custom slide #324

Answered by igordanchenko
dronem asked this question in Q&A
Discussion options

You must be logged in to vote

Please see if the following approach works for you.

import "./yarl.css";

// ..

const [index, setIndex] = React.useState<number>();
const [hideControls, setHideControls] = React.useState(false);

// ...

<Lightbox
  index={index}
  open={index !== undefined}
  close={() => setIndex(undefined)}
  on={{
    view: ({ index: currentIndex }) => {
      setIndex(currentIndex);
      setHideControls(slides[currentIndex].type === "custom-slide");
    },
  }}
  className={hideControls ? "yarl__hide-controls" : undefined}
  // ...
/>
/* yarl.css */

.yarl__hide-controls .yarl__toolbar,
.yarl__hide-controls .yarl__slide_captions_container {
  visibility: hidden;
}

Replies: 5 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Answer selected by igordanchenko
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@igordanchenko
Comment options

Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants