-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
75 lines (56 loc) · 1.79 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
const header = document.querySelector('header');
const links = document.querySelectorAll('.link')
window.addEventListener('scroll', ()=>{
header.classList.toggle('change',window.scrollY > 1);
for(let i=0; i<links.length; i++){
links[i].classList.toggle('diff', window.scrollY>1);
}
});
const dark = document.querySelector('.darkMode');
let darkMode = localStorage.getItem('darkMode');
const enableDarkMode = () => {
document.body.classList.add('dark');
localStorage.setItem('darkMode', 'enabled');
}
const disableDarkMode = () => {
document.body.classList.remove('dark');
localStorage.setItem('darkMode', null);
}
if (darkMode === 'enabled') {
enableDarkMode();
}
dark.addEventListener('click', ()=>{
darkMode = localStorage.getItem('darkMode');
if (darkMode !== 'enabled') {
enableDarkMode();
} else {
disableDarkMode();
}
});
const menu = document.querySelector('.menu');
const nav = document.querySelector('nav');
menu.addEventListener('click', ()=>{
header.classList.toggle('act');
nav.classList.toggle('active');
})
gsap.defaults({
ease:'power2.inOut',
duration: 1
})
var tl = gsap.timeline();
tl.from('.img1', {x: 600}).from('.img2', {x: 600},'-=0.9')
.from('.img3', {x: 600}, '-=0.9')
.from('.img4', {x: 600},'-=0.9')
.from('.img5', {x: 600},'-=0.9')
.from('.img6', {x: 600},'-=0.9')
.from('.img7', {x: 600},'-=0.9')
.from('.img8', {x: 600},'-=0.9')
.fromTo('.home-txt',{x:-730},{x:-55, duration: 1},'-=0.5')
.fromTo('.desc',{y:-100, opacity: 0},{y: 0 , opacity: 1, duration:1.5})
.to('.img1',{y:120},'-=1')
.to('.img2',{y:85},'-=1')
.to('.img3',{y:50},'-=1')
.to('.img4',{y:20},'-=1')
.to('.img6',{y:-20},'-=1')
.to('.img7',{y:-50},'-=1')
.to('.img8',{y:-70},'-=1');