-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
41 lines (38 loc) · 935 Bytes
/
script.js
File metadata and controls
41 lines (38 loc) · 935 Bytes
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
35
36
37
38
39
40
41
/* TYPING */
const el = document.getElementById("typing");
const text = "I'm SA-MP Player In ";
const clan = "ZxG";
let i = 0;
let del = false;
function typingLoop(){
if(!del){
if(i < text.length){
el.textContent += text[i++];
setTimeout(typingLoop,80);
}else{
el.innerHTML = text + `<span class="red">${clan}</span>`;
setTimeout(()=>del=true,1200);
setTimeout(typingLoop,1200);
}
}else{
if(i > 0){
i--;
el.textContent = text.substring(0,i);
setTimeout(typingLoop,40);
}else{
del=false;
el.textContent="";
setTimeout(typingLoop,500);
}
}
}
typingLoop();
/* FADE SCROLL */
const fades = document.querySelectorAll(".fade");
window.addEventListener("scroll",()=>{
fades.forEach(f=>{
if(f.getBoundingClientRect().top < window.innerHeight - 100){
f.classList.add("show");
}
});
});