Jason Phang
Well-known member
- Joined
- Aug 13, 2019
- Messages
- 46
- Programming Experience
- Beginner
I have a splash screen created for when I load my program, then the splash screen will be loaded and then after a few seconds, it will be redirected to my main home page. My main issue here is that the splash screen will be shown and then the main page will be shown for a second only before it refreshes and the splash screen loops again. I am not too sure if there is a problem with this block of code. I have tried 2 methods but both produce the same results.
Both of these loops the screen and only display my page for less than a second.
C#:
<div class="preload" id="preload">
<div class="logo">
Loa<span style="color: darkturquoise;">ding</span>
</div>
<div class="loader-frame">
<div class="loader1" id="loader1"></div>
<div class="loader2" id="loader2"></div>
</div>
</div>
<script type="text/javascript">
(function () {
var preload = document.getElementById("preload");
var loading = 0;
var id = setInterval(frame, 64);
function frame() {
if (loading == 100) {
clearInterval(id);
// window.location.href = "/Home/GetGoogleDriveFiles";
window.open("/Home/GetGoogleDriveFiles", "_self");
}
else {
loading = loading + 1;
if (loading == 90) {
preload.style.animation = "fadeout 1s ease";
}
}
}
})();
</script> -->
C#:
<body>
<div class="preload" id="preload">
<div class="logo">
Loa<span style="color: darkturquoise;">ding</span>
</div>
<div class="loader-frame">
<div class="loader1" id="loader1"></div>
<div class="loader2" id="loader2"></div>
</div>
</div>
<script type="text/javascript">
var timeOutInMilliSeconds = 5000;
setTimeout(function () {
location.href = "/Home/GetGoogleDriveFiles";
}, timeOutInMilliSeconds);
</script>
<div class="container body-content">
@RenderBody()
<hr />
</div>
<footer class="center bg-dark">
<p>Jason Phang Vern - Onn © 2019</p>
</footer>
</body>
</html>
Both of these loops the screen and only display my page for less than a second.