Skip to content
Advertisement

Why the Toggle buttons are flashing on reload?

When i reload my page, my toggle-buttons which are hidded by making opacity-0 appears on flash.

Is there any way to stop these flashes from appearing on reload and keep the (opacity-0) items hidden as intended?
Live Site URL
Codebase-Github Repo

JavaScript

Advertisement

Answer

One solution is to make all three themes hidden by default and onload method, you decide which theme you want to show, and by default, if there no clicked item in the localStorage show the first theme, and this will prevent flashing.

JavaScript
User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement