-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.js
More file actions
77 lines (67 loc) · 1.84 KB
/
app.js
File metadata and controls
77 lines (67 loc) · 1.84 KB
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
//My imports
import Person from "./export.js";
const panels=document.querySelectorAll(".panel")
const text=document.querySelector(".p-text")
const spa=document.querySelector(".spa-container")
const navItems=document.querySelectorAll(".nav-items")
const test=document.querySelector("h1")
const sun=document.querySelector(".sun")
const moon=document.querySelector(".moon")
const icons=document.querySelectorAll(".icon")
const date=new Date()
const aziz = new Person("Aziz",20,"data-scientist")
console.log(aziz)
//Darkmode implementation
icons.forEach(icon=>
icon.addEventListener('click',()=>
{
if(icon.dataset.theme=="light")
{
sun.style.display='none'
moon.style.display='block'
document.body.classList.add("lg-mode")
}else
{
sun.style.display='block'
moon.style.display='none'
document.body.classList.remove("lg-mode")
}
})
)
//Full page scroll horizontally
navItems.forEach(navItem=>
navItem.addEventListener('click',()=>
{
switch (parseInt(navItem.dataset.count)) {
case 2:
spa.style.transform='translateX(-100vw)';
break;
case 1:
spa.style.transform='translateX(0vw)';
break;
case 3:
spa.style.transform='translateX(-200vw)';
break;
}
}
)
)
//function Implementationn
function active()
{
panels.forEach(panel=> panel.classList.remove('active'))
this.classList.add('active')
}
var activeSection=()=>
{
if(text.getBoundingClientRect().top<window.scrollY)
{
text.classList.add("active-text")
}else
{
text.classList.remove("active-text")
}
}
//Events Call
window.addEventListener("scroll",activeSection)
panels.forEach(panel=>panel.addEventListener('click', active))