Skip to content

Transition doesn't work #124069

May 16, 2024 · 3 comments · 8 replies
Discussion options

You must be logged in to vote

I think you're problem is with style.display = "none". There are no intermediate states between displaying and not displaying so the element will just pop in and out. If you want the transition to ease smoothly, you're gonna have to use opacity in your JavaScript.

document.querySelector(".side-panel-toggle").addEventListener("click", () => {
  const sidePanel = document.querySelector(".side-panel");
  const iconOpen = document.querySelector(".sp-icon-open");
  const iconClose = document.querySelector(".sp-icon-close");

  // This toggles the class and returns the new state of 'isOpen'
  const isOpen = sidePanel.classList.toggle("side-panel-expanded");

  // Adjusting styles based on the p…

Replies: 3 comments 8 replies

Comment options

You must be logged in to vote
3 replies
@LuComic
Comment options

@GurbanmyradowSerdar
Comment options

@LuComic
Comment options

Comment options

You must be logged in to vote
0 replies

This comment was marked as off-topic.

@LuComic
Comment options

@judahpaul16

This comment was marked as off-topic.

@LuComic
Comment options

@judahpaul16

This comment was marked as off-topic.

@LuComic
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Programming Help Programming languages, open source, and software development.
4 participants