- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
Latest commit
33 lines (29 loc) · 871 Bytes
/
Copy pathscript.js
File metadata and controls
33 lines (29 loc) · 871 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
// Typing animation
functiontypeText(element,text,delay=100,callback=null){
element.textContent="";
leti=0;
functiontype(){
if(i<text.length){
element.textContent+=text.charAt(i);
i++;
setTimeout(type,delay);
}elseif(callback){
callback();
}
}
type();
}
document.addEventListener("DOMContentLoaded",()=>{
constplayButton=document.getElementById("playButton");
constaskToPlayMessage=document.getElementById("askToPlayMessage");
// Play button on click action
constplayButton_OnClick=()=>{
window.open("./Games/birthday_message/","_self");
};
typeText(askToPlayMessage,"Do you want to play a game with me?",70,()=>{
setTimeout(()=>{
playButton.style.opacity="1";
},700);
});
playButton.addEventListener("click",playButton_OnClick);
});