My webpage has a style similar to this https://i.sstatic.net/k6TGg.png
I am attempting to modify the CSS using JavaScript when a button is clicked.
This is my JavaScript code:
this.document.getElementById('style-bandle').setAttribute('href','./assets/demo/default/base/style.bundle.rtl.css');
When I click on the button, the CSS file changes. However, there is a brief moment where the styling is lost before the new CSS file loads, as shown in the second image https://i.sstatic.net/wO2kP.png.
After the CSS finishes loading, the page reverts back to its original style like the first image. How can I prevent this flash of unstyled content?