After experimenting with different types of masks, I wanted to be able to dynamically create a CSS class and apply it after the DOM had loaded in order to achieve an overlay mask effect. However, my initial attempt was unsuccessful:
var style = document.createElement('style');
style.type = 'text/css';
style.innerHTML = '.overlay-loader-mobile-edition { height: 100%; width: 100%; position: fixed !important; z-index: 5000000 !important;left: 0!important;background-color: rgb(0,0,0);background-color: rgba(0,0,0,0.9);overflow-x:hidden;transition: 0.5s;}';
document.getElementsByTagName('head')[0].appendChild(style);
document.body.className = 'overlay-loader-mobile-edition';
I found no success using this method. When testing on Google and running the same command in console, the results were not as expected:
https://i.sstatic.net/iGRSj.jpg
In my research, I came across a similar example on W3Schools website: https://www.w3schools.com/howto/tryit.asp?filename=tryhow_js_overlay