yumedoll
Active Coder
I have this:
I've placed them in my HTML document using
I want to make a simple loading UI for a game I've made. It's supposed to hide the loading gif file after the website is fully loaded and its place will be the play button. This method has worked for the other game I've made completely fine, in which I placed it in script tags somewhere near the end of that game's document.
But the issue I'm facing is it doesn't seem to work no matter where I place it in this specific document. Excuse the spaghetti code btw, but still.
I've tried placing it directly below the style code of the opening splash screen:
But it didn't work.
Then, I tried placing it within the very same
But it didn't work either. However, the script for opening the recipe book worked just fine.
I tried to make the initial values of the play button and the loading gif the same as the function in the DOM's load EventListener,
But that did nothing but leave me just waiting for an endless looping gif to be replaced by a play button, only to realize it wasn't even taking into account whether it was loading or not in the first place.
I tried checking for issues in the console, but no huge issues, let alone actually related issues came up.
I tried deleting my cache and reloading again, even using different browsers, but still no loading animation.
Can anyone help me out?
JavaScript:
document.documentElement.addEventListener("load", function(){
document.getElementById("loading").style.display = "block";
document.getElementById("okthanks").style.display = "none";
});
window.addEventListener("load", function(){
document.getElementById("loading").style.display = "none";
document.getElementById("okthanks").style.display = "block";
});
<script></script>
tags.I want to make a simple loading UI for a game I've made. It's supposed to hide the loading gif file after the website is fully loaded and its place will be the play button. This method has worked for the other game I've made completely fine, in which I placed it in script tags somewhere near the end of that game's document.
But the issue I'm facing is it doesn't seem to work no matter where I place it in this specific document. Excuse the spaghetti code btw, but still.
I've tried placing it directly below the style code of the opening splash screen:
HTML:
<div style="font-family: umeboshi; display: block;" align="middle" class="profile">
<h1
style="border: 25px transparent solid!important; border-image: url(https://i.ibb.co/sK11sRT/Untitled122-20230317200942.png) round 30%!important; font-family: umeboshi!important;"
align="middle">ケーキ作ろう</h1>
<p align="middle" style=" font-size: 40pt; font-family: umeboshi;">※このゲームはモバイルでやるのできますが、端末用に最適化されていません。</p>
<p align="middle" style=" font-size: 40pt; font-family: umeboshi;">※素人が作ったゲームで、バグがあれば遠慮なく報告してください。</p>
<p align="middle" style=" font-size: 40pt; font-family: umeboshi;">※音と音楽が入ってます。</p>
<img style="display: none" src="loading.gif" id="loading">
<a align="middle" style="display: block; font-family: umeboshi;" class="button" id="okthanks"
onclick="this.parentElement.style.display = 'none';">プレイ</a>
</div>
<style>
.profile {
z-index: 2000;
width: 1015px;
height: 100%;
padding: 6% 12%;
font-size: 200%;
background-image: url('plaid.png');
background-repeat: repeat;
background-position: center;
background-size: 200px 200px;
background-color: white;
opacity: 1;
transition: 0.5s;
display: block;
position: fixed;
top: 0vh;
left: 0vh;
opacity: 1;
transition: opacity 0.6s;
}
#okthanks {
font-size: 60px;
width: fit-content;
border: 25px solid transparent;
border-image: url('https://i.ibb.co/sK11sRT/Untitled122-20230317200942.png') round 30%;
transition: 0.3s;
}
#okthanks:hover {
background-color: #fcebf4;
}
.profile>ul {
padding: 10px 50px;
border: 10px #ffb3cc dotted;
border-radius: 20px;
font-family: umeboshi;
background-color: white;
}
</style>
<script>
document.documentElement.addEventListener("load", function(){
document.getElementById("loading").style.display = "block";
document.getElementById("okthanks").style.display = "none";
});
window.addEventListener("load", function(){
document.getElementById("loading").style.display = "none";
document.getElementById("okthanks").style.display = "block";
});
</script>
But it didn't work.
Then, I tried placing it within the very same
<script>
of the script used to "open the recipe book" in the game:
HTML:
<script>
document.documentElement.addEventListener("load", function(){
document.getElementById("loading").style.display = "block";
document.getElementById("okthanks").style.display = "none";
});
window.addEventListener("load", function(){
document.getElementById("loading").style.display = "none";
document.getElementById("okthanks").style.display = "block";
});
let recipebookstate = false;
document.getElementById("bookicon").addEventListener("click", ()=>{
if(recipebookstate == false){
document.getElementById('recipebook').style.bottom = '1100px';
recipebookstate = true;
}
else if(recipebookstate == true){
document.getElementById('recipebook').style.bottom = '0px';
recipebookstate = false;
}
})
</script>
I tried to make the initial values of the play button and the loading gif the same as the function in the DOM's load EventListener,
But that did nothing but leave me just waiting for an endless looping gif to be replaced by a play button, only to realize it wasn't even taking into account whether it was loading or not in the first place.
I tried checking for issues in the console, but no huge issues, let alone actually related issues came up.
I tried deleting my cache and reloading again, even using different browsers, but still no loading animation.
Can anyone help me out?