-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathpercent-preloader.js
34 lines (33 loc) · 941 Bytes
/
percent-preloader.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
/*!
* Percent-Preloader JS - v1
* @author JDM Digital - https://jdmdigital.co
* Copyright (c) 2022
*/
var counting = setInterval(function () {
var loader = document.getElementById("percentage");
var currval = parseInt(loader.innerHTML);
var Width = 99 - currval;
var loadscreen = document.getElementById("loader-progress");
loader.innerHTML = ++currval;
if (currval > 89){
loader.innerHTML = 90;
if(window.jQuery) {
//console.log('jquery loaded');
loader.innerHTML = 95;
if(document.readyState == "interactive") {
loader.innerHTML = 99;
}
if(document.readyState == "complete") {
//console.log('fully loaded!');
clearInterval(counting);
loader.innerHTML = 100;
jQuery("body").toggleClass('page-loaded');
setTimeout(function() {
jQuery('nav').css('visibility','visible')
}, 880);
}
}
}
loadscreen.style.transition = "0.15s";
loadscreen.style.width = Width + "%";
}, 20);