For a while now, I've been avoiding using JavaScript because every time I attempt to understand it, I become more confused. However, I am now in need of it for a website I'm developing...
I would like to hide the page until everything loads so that you don't see elements shifting or appearing abruptly.
I have come across various solutions both here and on the web, but whenever I try to implement the code where I think it should go, I encounter errors.
Consider the following example:
window.onload=function() {
document.getElementById('loading-mask').style.display='none';
}
I have attempted adding the JavaScript code I found online to the functions.php file, but I always end up with an error. Where should I paste this code to ensure it interacts correctly with the CSS modifications I have made?