-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
130 lines (108 loc) · 3.72 KB
/
Copy pathscript.js
File metadata and controls
130 lines (108 loc) · 3.72 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
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
// let text = document.getElementById('text');
window.addEventListener('scroll', () => {
let value = window.scrollY;
console.log(value)
if (value<400){
text.style.marginTop = value * 2.5 + 'px';
}
});
window.addEventListener('scroll', () => {
let value = window.scrollY;
if (value>=0){
more.style.opacity = 1-value*0.001*3.7313432835820895522388059701493;
arrow.style.opacity = 1-value*0.001*3.7313432835820895522388059701493;
}
});
window.addEventListener('scroll', () => {
let value = window.scrollY;
if (value>=700){
more.style.display = 'none';
arrow.style.display = 'none';
} else {
more.style.display = 'inline';
arrow.style.display = 'inline';
}
});
window.addEventListener('scroll', () => {
let value = window.scrollY;
if (value>=740){
more1.style.display = 'inline';
space1.style.display = 'inline';
} else {
more1.style.display = 'none';
space1.style.display = 'none';
}
});
window.addEventListener('scroll', () => {
let value = window.scrollY;
console.log(1+((1100-value)*(0.01)));
if (value>=1000){
more1.style.opacity = 1+((1000-value)*(0.01));
space1.style.opacity = 1+((1000-value)*(0.01));
} else {
more1.style.opacity = 1
space1.style.opacity = 1
}
});
// window.addEventListener('scroll', () => {
// let value = window.scrollY;
// var element = document.getElementById("arrow")
// var element1 = document.getElementById("more")
// console.log(value)
// if (value>=75){
// element.classList.add("fade");
// element1.classList.add("fade")
// } else {
// element.classList.remove("fade");
// element1.classList.remove("fade")
// }
// });
function toggleNavigation() {
var navigation = document.getElementById('navigate');
var toggleButton = document.getElementById('toggleButton');
navigation.classList.toggle('hide');
toggleButton.classList.toggle('active');
// toggleButton.classList.toggle('hide')
}
let sections = document.querySelectorAll('section');
let navLinks = document.querySelectorAll('header nav a')
window.onscroll = () => {
sections.forEach(sec => {
let top = window.scrollY;
let offset = sec.offsetTop;
let height = sec.offsetHeight;
let id = sec.getAttribute('id');
if(top >= offset && top < offset + height) {
navLinks.forEach(links => {
links.classList.remove('active')
document.querySelector('header nav a[href*=' + id + ']').classList.add('active');
});
};
});
};
// var parentElement = document.getElementById('navigation');
// parentElement.addEventListener('click', function(event) {
// console.log('Button clicked:', event.target);
// });
// setActive(section){
// document.getElementById('navigation').children.forEach(e => {
// e.classList.remove('active')
// });
// }
// document.addEventListener('DOMContentLoaded', function () {
// var links = document.querySelectorAll('a[href^="#"]');
// links.forEach(function (link) {
// link.addEventListener('click', function (e) {
// e.preventDefault();
// var targetId = this.getAttribute('href').substring(1);
// var targetElement = document.getElementById(targetId);
// if (targetElement) {
// var offsetTop = targetElement.offsetTop;
// window.scrollTo({
// top: offsetTop+1,
// behavior: 'smooth'
// });
// }
// });
// });
// });