-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
47 lines (39 loc) · 1.45 KB
/
Copy pathscript.js
File metadata and controls
47 lines (39 loc) · 1.45 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
topButton = document.querySelector('#topBtn');
header = document.querySelector('header');
window.onscroll = function() {
scrollFunction();
};
function scrollFunction() {
if (document.documentElement.scrollTop > 300) {
topButton.style.display = "block";
header.style.position = 'fixed'
header.style.boxShadow = '4px 3px 2px #ccc'
}else {
topButton.style.display = "none";
header.style.position = 'initial'
};
};
function topFunction() {
document.documentElement.scrollTop = 0;
}
document.querySelector('#copyright')
.appendChild(document.createTextNode(new Date().getFullYear()));
document.querySelector('.drop-line').addEventListener('click', () => {
document.querySelector('.dropdown').classList.toggle('pop-out');
});
dropdown = document.querySelector('.dropdown');
dropdown.addEventListener('click', () => {
dropdown.classList.toggle('pop-out');
});
let questions = document.querySelectorAll('.questions');
questions.forEach((question) => {
let btn = question.querySelector('.question-btn');
btn.addEventListener('click', () => {
questions.forEach((item) => {
if (item !== question) {
item.classList.remove('show-text')
}
})
question.classList.toggle('show-text')
})
})