I am working with a web application from a different company that has some customization options limited to CSS and allows me to add HTML content at certain points in the code.
However, I need more flexibility than what CSS can offer, so I have resorted to injecting jQuery and employing JavaScript to manipulate the HTML elements they provide. This has caused a problem where users may briefly see the original page layout before it changes.
Instead of waiting for specific events like 'load' or 'document.ready', I am directly manipulating the DOM as soon as all elements are added.
How can I prevent users from seeing the temporary layout while the page loads?
My current solution involves using CSS to hide content that will be moved, applying a class to the <body>
element with JavaScript upon loading to enable the hiding, and then removing the class once the DOM manipulation is complete. Is there a cleaner way to achieve this without resorting to hacks?