-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
97 lines (73 loc) · 3.06 KB
/
script.js
File metadata and controls
97 lines (73 loc) · 3.06 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
document.addEventListener('DOMContentLoaded', ()=>{
/*Humburger menu */
const menuBtn = document.querySelector ('.hamburger-menu-btn');
const navLinks = document.querySelector ('nav ul');
if (menuBtn && navLinks) {
menuBtn.addEventListener ('click', () =>{
menuBtn.classList.toggle('open');
navLinks.classList.toggle ('active');
});
}
/* info.html Pages*/
const urlParams= new URLSearchParams(window.location.search);
const page= urlParams.get('page');
const companySection = document.getElementById('company-section');
const faqSection = document.getElementById ('faq-section');
const policySection = document.getElementById ('policy-section');
const infoCta = document.getElementById ('info-cta')
/*Απόκρυψη όλων */
if (companySection) companySection.style.display = 'none';
if (faqSection) faqSection.style.display = 'none';
if (policySection) policySection.style.display = 'none';
if (infoCta) infoCta.style.display = 'none';
/*Εμφάνιση Sections ξεχωριστά */
if (page === 'faq') {
if (faqSection) faqSection.style.display = 'block';
if (infoCta) infoCta.style.display = 'block';
}
else if (page === 'policy') {
if (policySection) policySection.style.display = 'block';
if (infoCta) infoCta.style.display = 'block';
}
else {
if (companySection) companySection.style.display = 'block';
}
/* FAQ Section */
const faqItems = document.querySelectorAll ('.faq-item');
faqItems.forEach(item => {
const question = item.querySelector ('.faq-question');
const icon = item.querySelector ('.faq-icon');
if (question){
question.addEventListener ('click',() =>{
faqItems.forEach (otherItem => {
if (otherItem !== item) {
otherItem.classList.remove('active');
const otherIcon = otherItem.querySelector ('.faq-icon');
if (otherIcon) otherIcon.textContent = '+';
}
});
const isActive = item.classList.toggle ('active');
if (icon){
icon.textContent = isActive ? '-': '+';
}
});
}
});
/* FAQ Search Bar */
const searchInput = document.getElementById ('faq-search-input');
if (searchInput) {
searchInput.addEventListener ('input' , (e) => {
const term = e.target.value.toLowerCase();
faqItems.forEach( item => {
const questionText = item.querySelector ('h3') .textContent.toLowerCase();
const answerText = item.querySelector('.faq-answer') .textContent.toLowerCase();
if (questionText.includes(term) || answerText.includes(term)) {
item.style.display = 'block';
}
else {
item.style.display = 'none';
}
});
});
}
});