Prvotna verzija spletne strani
This commit is contained in:
1 parent
9d09f04023
commit
79150b21d2
58 files changed
+8507
No files matched your search
@@ -0,0 +1,141 @@
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
|
||||
// --- Mobile Menu Toggle ---
|
||||
const mobileMenuIcon = document.querySelector('.mobile-menu-icon');
|
||||
const body = document.querySelector('body');
|
||||
|
||||
if (mobileMenuIcon && body) {
|
||||
mobileMenuIcon.addEventListener('click', () => {
|
||||
// Preklopi razred 'nav-open' na body elementu za prikaz/skrivanje menija
|
||||
body.classList.toggle('nav-open');
|
||||
});
|
||||
}
|
||||
|
||||
// --- Language Switcher ---
|
||||
const languageSelectors = document.querySelectorAll('.language-selector');
|
||||
|
||||
if (languageSelectors.length > 0) {
|
||||
languageSelectors.forEach(selector => {
|
||||
const currentLang = selector.querySelector('.current-lang');
|
||||
|
||||
if (currentLang) {
|
||||
currentLang.addEventListener('click', (event) => {
|
||||
// Prepreči, da bi klik na sprožilec takoj zaprl meni (zaradi globalnega listenerja)
|
||||
event.stopPropagation();
|
||||
|
||||
// Preklopi .active razred na trenutnem menjalniku
|
||||
selector.classList.toggle('active');
|
||||
|
||||
// Zapri vse ostale odprte menjalnike jezikov
|
||||
languageSelectors.forEach(otherSelector => {
|
||||
if (otherSelector !== selector) {
|
||||
otherSelector.classList.remove('active');
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// Globalni listener za zapiranje menija ob kliku izven njega
|
||||
window.addEventListener('click', () => {
|
||||
languageSelectors.forEach(selector => {
|
||||
selector.classList.remove('active');
|
||||
});
|
||||
});
|
||||
|
||||
// Globalni listener za zapiranje menija s tipko Escape
|
||||
window.addEventListener('keydown', (event) => {
|
||||
if (event.key === 'Escape') {
|
||||
languageSelectors.forEach(selector => {
|
||||
selector.classList.remove('active');
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// Logika za dinamično generiranje URL-jev ostaja enaka
|
||||
// Ta del poskrbi, da povezave v meniju vodijo na pravo jezikovno različico strani
|
||||
const path = window.location.pathname;
|
||||
const pathParts = path.split('/').filter(Boolean);
|
||||
|
||||
// Predpostavka: prvi del poti je vedno jezikovna koda
|
||||
const currentLangCode = pathParts[0] || 'si'; // Privzeto na 'si', če ni določeno
|
||||
const relativePath = path.substring(path.indexOf(currentLangCode) + currentLangCode.length);
|
||||
|
||||
languageSelectors.forEach(selector => {
|
||||
const langLinks = selector.querySelectorAll('.lang-dropdown a[data-lang]');
|
||||
langLinks.forEach(link => {
|
||||
const targetLang = link.getAttribute('data-lang');
|
||||
const newUrl = `/${targetLang}${relativePath}`;
|
||||
link.setAttribute('href', newUrl);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
// --- FAQ Accordion ---
|
||||
const faqItems = document.querySelectorAll('.faq-item');
|
||||
|
||||
if (faqItems.length > 0) {
|
||||
faqItems.forEach(item => {
|
||||
const header = item.querySelector('h3');
|
||||
if (header) {
|
||||
header.addEventListener('click', () => {
|
||||
const content = item.querySelector('p');
|
||||
if (content) {
|
||||
// Preprost preklop prikaza. Za napredno harmoniko bi uporabili razrede.
|
||||
if (content.style.display === "none" || content.style.display === "") {
|
||||
content.style.display = "block";
|
||||
} else {
|
||||
content.style.display = "none";
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// --- Activities Tab ---
|
||||
const activityNavItems = document.querySelectorAll('.activities-nav li');
|
||||
const activityDetailsText = document.querySelector('.activity-details p');
|
||||
const activityDetailsImage = document.querySelector('.activity-details img');
|
||||
|
||||
// Placeholder vsebina za različne aktivnosti
|
||||
const activitiesData = {
|
||||
// Slovenska vsebina
|
||||
'Študentsko predstavništvo': { text: 'Vsebina za študentsko predstavništvo...'},
|
||||
'Izobraževanje in kultura': { text: 'Vsebina za izobraževanje in kulturo...'},
|
||||
'Zabava in druženje': { text: 'Vsebina za zabavo in druženje...'},
|
||||
'Študentska podpora': { text: 'Vsebina za študentsko podoro...'},
|
||||
// Angleška vsebina
|
||||
'Student representation': { text: 'Content for student representation...'},
|
||||
'Education and culture': { text: 'Content for education and culture...'},
|
||||
'Entertainment and socializing': { text: 'Content for entertainment and socializing...'},
|
||||
'Student support': { text: 'Content for student support...'},
|
||||
// Makedonska vsebina
|
||||
'Студентско претставување': { text: 'Содржина за студентско претставување...'},
|
||||
'Образование и култура': { text: 'Содржина за образование и култура...'},
|
||||
'Забава и дружење': { text: 'Содржина за забава и дружење...'},
|
||||
'Студентска поддршка': { text: 'Содржина за студентска поддршка...'}
|
||||
};
|
||||
|
||||
if (activityNavItems.length > 0 && activityDetailsText) {
|
||||
activityNavItems.forEach(item => {
|
||||
item.addEventListener('click', () => {
|
||||
// Odstrani .active razred z vseh elementov
|
||||
activityNavItems.forEach(navItem => navItem.classList.remove('active'));
|
||||
// Dodaj .active razred na kliknjen element
|
||||
item.classList.add('active');
|
||||
|
||||
// Posodobi vsebino glede na besedilo kliknjenega elementa
|
||||
const activityName = item.textContent.trim();
|
||||
if (activitiesData[activityName]) {
|
||||
activityDetailsText.textContent = activitiesData[activityName].text;
|
||||
// Tukaj bi lahko posodobili tudi sliko, če je potrebno
|
||||
// if (activityDetailsImage) {
|
||||
// activityDetailsImage.src = activitiesData[activityName].image;
|
||||
// }
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
Reference in new issue
Block a user