-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
168 lines (136 loc) · 6.02 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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
const header = document.querySelector('#header');
const about = document.querySelector('#about');
const work = document.querySelector('#work');
const odvar = document.querySelector('#odvar');
const website = document.querySelector('#website');
const pong = document.querySelector('#pong');
const moviedata = document.querySelector('#moviedata');
const memorygame = document.querySelector('#memorygame');
const freelance = document.querySelector('#freelance');
const freelance2 = document.querySelector('#freelance2');
const dev = document.querySelector('#dev');
const from = document.querySelector('#from');
const contact = document.querySelector('#contact');
function callback(entries) {
entries.forEach((entry) => {
const adBox = entry.target;
const inSec = entry.intersectionRatio;
adBox.style.opacity = inSec*10;
// console.log(adBox, inSec*10);
})
//about.style.opacity = (entries[0].intersectionRatio)*2;
}
var options = {
root: null,
threshold: [0, 0.05, 0.1]
}
var io = new IntersectionObserver(callback, options);
io.observe(header);
io.observe(about);
io.observe(odvar);
io.observe(website);
io.observe(pong);
io.observe(moviedata);
io.observe(memorygame);
io.observe(freelance);
io.observe(freelance2);
io.observe(dev);
io.observe(from);
io.observe(contact);
// Access Settings
const modal = document.querySelector('.modal');
const open_Modal = document.querySelector('.access_settings');//
const close_Modal = document.querySelector('.close-modal');
open_Modal.addEventListener('click', () => {
modal.showModal();
})
close_Modal.addEventListener('click', () => {
modal.close();
})
//Fonts
const root = document.querySelector(":root");
const rootStyles = getComputedStyle(root);
let font_size = rootStyles.getPropertyValue('--font-size');
let font_family = rootStyles.getPropertyValue('--font-family');
let bg_col = rootStyles.getPropertyValue('--bg-col');
let text_col = rootStyles.getPropertyValue('--txt-col');
let article_col = rootStyles.getPropertyValue("--article-col");
let section_bg = rootStyles.getPropertyValue("--section-bg");
let button_activebg = rootStyles.getPropertyValue("--button-activebg");
let button_innerbg = rootStyles.getPropertyValue("--button-innerbg");
// root.style.setProperty('--font-size', '38px' );
// root.style.setProperty('--txt-col', 'black' );
// root.style.setProperty('--bg-col', 'white' );
//BUTTONS = FontSize, FontFamily, ColourScheme
const fsb1 = document.querySelector("#fsb1");
const fsb2 = document.querySelector("#fsb2");
const fsb3 = document.querySelector("#fsb3");
const ffb1 = document.querySelector("#ffb1");
const ffb2 = document.querySelector("#ffb2");
const ffb3 = document.querySelector("#ffb3");
const ffb4 = document.querySelector("#ffb4");
const ffb5 = document.querySelector("#ffb5");
const ffb6 = document.querySelector("#ffb6");
const csb1 = document.querySelector("#csb1");
const csb2 = document.querySelector("#csb2");
const csb3 = document.querySelector("#csb3");
const btnArray = document.querySelectorAll(".asbtn");
btnArray.forEach(element => {
element.addEventListener("click", function(e) {
console.log(e.target.id);
if (e.target.id === "csb1") {
root.style.setProperty('--bg-col', 'rgba(233, 233, 233, 1)' );
root.style.setProperty('--txt-col', 'rgba(0,0,0,1)' );
root.style.setProperty('--article-col', 'rgb(129, 255, 196)' );
root.style.setProperty('--section-bg', 'rgb(252, 86, 255)' );
root.style.setProperty('--button-activebg', 'rgb(246, 0, 250)' );
root.style.setProperty('--button-innerbg', 'rgba(207, 189, 219, 0.747)' );
root.style.setProperty('--shadows-article1', 'rgb(221, 155, 222)' );
root.style.setProperty('--shadows-img', 'rgb(0, 255, 132)' );
} else if (e.target.id === "csb2") {
root.style.setProperty('--bg-col', 'rgb(31, 24, 24)' );
root.style.setProperty('--txt-col', 'rgb(232, 232, 232)' );
root.style.setProperty('--article-col', 'rgb(48, 0, 67)' );
root.style.setProperty('--section-bg', 'rgba(110, 83, 120, 0.865)' );
root.style.setProperty('--button-activebg', 'rgb(221, 155, 222)' );
root.style.setProperty('--button-innerbg', 'rgba(67, 51, 73, 0.865)' );
root.style.setProperty('--shadows-article1', 'rgb(221, 155, 222)' );
root.style.setProperty('--shadows-img', 'rgb(20, 0, 40)' );
} else if (e.target.id === "csb3") {
root.style.setProperty('--bg-col', '#fdfcdc' );
root.style.setProperty('--txt-col', '#0f171a' );
root.style.setProperty('--article-col', '#fed9b7' );
root.style.setProperty('--section-bg', '#00afb9' );
root.style.setProperty('--button-activebg', 'rgb(240, 113, 103)' );
root.style.setProperty('--button-innerbg', '#fdfcdc' );
root.style.setProperty('--shadows-article1', '#81b9ff' );
root.style.setProperty('--shadows-img', 'rgb(255, 177, 241)' );
}
else if (e.target.id === "ffb1") {
root.style.setProperty('--font-family', 'Hanken Grotesk');
} else if (e.target.id === "ffb2") {
root.style.setProperty('--font-family', 'garamond');
} else if (e.target.id === "ffb3") {
root.style.setProperty('--font-family', 'eskool');
} else if (e.target.id === "ffb4") {
root.style.setProperty('--font-family', 'neutralface');
} else if (e.target.id === "ffb5") {
root.style.setProperty('--font-family', 'Yatra One');
} else if (e.target.id === "ffb6") {
root.style.setProperty('--font-family', 'youngserif');
} else if (e.target.id === "fsb1") {
root.style.setProperty('--font-size', '24px');
} else if (e.target.id === "fsb2") {
root.style.setProperty('--font-size', '30px');
} else if (e.target.id === "fsb3") {
root.style.setProperty('--font-size', '38px');
}
});
});
//cursor follow
// let circle = document.getElementById('circle');
// const onMouseMove = (e) =>{
// circle.style.left = e.pageX + 'px';
// circle.style.top = e.pageY + 'px';
// }
// document.addEventListener('mousemove', onMouseMove);