Access our premium support and let us know your problems, we will help you solve them.

0
No products in the cart.

Forum Replies Created

Viewing 1 post (of 1 total)
  • Author
    Posts
  • in reply to: Light mode dark mode toggle #10070
    blank3rdthemagical
    Participant

    Just swap visibility values.

    function toggleTheme() {
      const darkThemeBtn = document.getElementsByClassName("theme-toggle-dark")[0];
      const lightThemeBtn = document.getElementsByClassName("theme-toggle-light")[0];
    
      const darkThemeState = darkThemeBtn.style.visibility;
    
      darkThemeBtn.style.visibility = lightThemeBtn.style.visibility;
      lightThemeBtn.style.visibility = darkThemeState;
    }
    
Viewing 1 post (of 1 total)