-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
86 lines (70 loc) · 2.08 KB
/
app.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
/*===== MENU SHOW =====*/
const showMenu = (toggleId, navId) =>{
const toggle = document.getElementById(toggleId),
nav = document.getElementById(navId)
if(toggle && nav){
toggle.addEventListener('click', ()=>{
nav.classList.toggle('show')
})
}
}
showMenu('nav-toggle','nav-menu')
/*===== ACTIVE AND REMOVE MENU =====*/
const navLink = document.querySelectorAll('.nav__link');
function linkAction(){
/*Active link*/
navLink.forEach(n => n.classList.remove('active'));
this.classList.add('active');
/*Remove menu mobile*/
const navMenu = document.getElementById('nav-menu')
navMenu.classList.remove('show')
}
navLink.forEach(n => n.addEventListener('click', linkAction));
/*===== SCROLL REVEAL ANIMATION =====*/
const sr = ScrollReveal({
origin: 'top',
distance: '80px',
duration: 2000,
reset: true
});
/*SCROLL HOME*/
sr.reveal('.home__title',{});
sr.reveal('.button',{delay: 200});
sr.reveal('.home__img',{delay: 400});
sr.reveal('.home__social-icon',{ interval: 200});
/*SCROLL ABOUT*/
sr.reveal('.about__img',{});
sr.reveal('.about__subtitle',{delay: 400});
sr.reveal('.about__typing',{delay: 400});
sr.reveal('.about__text',{delay: 400});
/*SCROLL WORK*/
sr.reveal('.work__img',{interval: 200});
/*SCROLL CONTACT*/
sr.reveal('.contact__input',{interval: 200});
var typed = new Typed(".typing-1", {
strings: ["Developer", "Designer"],
typeSpeed: 70,
backSpeed: 40,
loop: true
});
var typed = new Typed(".typing", {
strings: ["Developer", "Designer"],
typeSpeed: 70,
backSpeed: 30,
loop: true
});
document.addEventListener('DOMContentLoaded', () => {
const groups = document.querySelectorAll('.skills__group');
const observer = new IntersectionObserver((entries, obs) => {
entries.forEach(entry => {
if (entry.isIntersecting) {
entry.target.classList.add('show');
obs.unobserve(entry.target);
}
});
}, {
rootMargin: '0px 0px -10% 0px',
threshold: 0.1
});
groups.forEach(group => observer.observe(group));
});