-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
53 lines (40 loc) · 1.3 KB
/
index.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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
const handleFirstTab = (e) => {
if (e.key === 'Tab') {
document.body.classList.add('user-is-tabbing')
window.removeEventListener('keydown', handleFirstTab)
window.addEventListener('mousedown', handleMouseDownOnce)
}
}
const handleMouseDownOnce = () => {
document.body.classList.remove('user-is-tabbing')
window.removeEventListener('mousedown', handleMouseDownOnce)
window.addEventListener('keydown', handleFirstTab)
}
window.addEventListener('keydown', handleFirstTab)
const backToTopButton = document.querySelector(".back-to-top");
let isBackToTopRendered = false;
let alterStyles = (isBackToTopRendered) => {
backToTopButton.style.visibility = isBackToTopRendered ? "visible" : "hidden";
backToTopButton.style.opacity = isBackToTopRendered ? 1 : 0;
backToTopButton.style.transform = isBackToTopRendered
? "scale(1)"
: "scale(0)";
};
window.addEventListener("scroll", () => {
if (window.scrollY > 700) {
isBackToTopRendered = true;
alterStyles(isBackToTopRendered);
} else {
isBackToTopRendered = false;
alterStyles(isBackToTopRendered);
}
});
var typed2 = new Typed('#typed', {
strings: ['I am a Full stack developer', 'I am from TamilNadu, India'],
typeSpeed: 20,
backSpeed: 5,
backDelay: 2000,
startDelay: 1000,
fadeOut: true,
loop: true
});