I have a loader screen which is just simply a white screen at this point. It all works fine on desktop but when on mobile view the whole hero header either disappears or shrinks entirely.
I'm looking for a line of code that might just disable just the javascript on this page when in mobile view. I don't want to disable javascript all together as I have a separate js file which will be needed.
I believe it is occuring due to one element in particular:
document.getElementById("myDiv").style.display = "block";
Here is the full code anyhow.
<style>
/* Center the loader */
.animate-bottom {
-webkit-animation-name: animatebottom;
-webkit-animation-duration: 1s;
animation-name: animatebottom;
animation-duration: 1s
}
@-webkit-keyframes animatebottom {
from { bottom:-100px; opacity:0 }
to { bottom:0px; opacity:1 }
}
@keyframes animatebottom {
from{ bottom:-100px; opacity:0 }
to{ bottom:0; opacity:1 }
}
</style>
</head>
<body onload="myFunction()" >
<div id="loader"></div>
<div style="display:none;" id="myDiv" class="animate-bottom">
//CONTENT OF THE PAGE
</div>
<script>
var myVar;
function myFunction() {
myVar = setTimeout(showPage, 800);
}
function showPage() {
document.getElementById("loader").style.display = "none";
document.getElementById("myDiv").style.display = "block";
}
</script>
</body>