-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscripts.js
68 lines (61 loc) · 2.36 KB
/
scripts.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
function navigateTo(url, direction = 'left') {
const mainContent = document.getElementById('main-content');
// Odstranění předchozích tříd animace
mainContent.classList.remove('slide-in-from-left', 'slide-in-from-right', 'slide-in-from-top', 'slide-in-from-bottom', 'slide-out-to-left', 'slide-out-to-right', 'slide-out-to-top', 'slide-out-to-bottom');
// Add the appropriate slide-out class based on direction
switch(direction) {
case 'right':
mainContent.classList.add('slide-out-to-right');
break;
case 'up':
mainContent.classList.add('slide-out-to-top');
break;
case 'down':
mainContent.classList.add('slide-out-to-bottom');
break;
case 'left':
default:
mainContent.classList.add('slide-out-to-left');
break;
}
setTimeout(() => {
window.location.href = url;
}, 300); // odpovídá délce animace
}
function showPopup(event) {
event.preventDefault();
const popup = document.getElementById('popup');
const countdown = document.getElementById('countdown');
let timeLeft = 3;
popup.style.display = 'block';
const countdownInterval = setInterval(() => {
if (timeLeft > 0) {
countdown.textContent = timeLeft;
timeLeft--;
} else {
clearInterval(countdownInterval);
window.location.href = '../index.html';
}
}, 1000);
}
// animace otevření a zavření hamburger menu
function toggleMenu() {
const menuOverlay = document.getElementById('menuOverlay');
const hamburgerIcon = document.querySelector('.hamburger-icon');
const closeIcon = document.querySelector('.close-icon');
if (menuOverlay.classList.contains('open')) {
menuOverlay.classList.remove('open');
menuOverlay.classList.add('close');
setTimeout(() => {
menuOverlay.style.display = 'none';
}, 500); // Duration of the animation should match the CSS animation duration
hamburgerIcon.style.display = 'block';
closeIcon.style.display = 'none';
} else {
menuOverlay.style.display = 'block';
menuOverlay.classList.remove('close');
menuOverlay.classList.add('open');
hamburgerIcon.style.display = 'none';
closeIcon.style.display = 'block';
}
}