-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
29 lines (24 loc) · 1 KB
/
app.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
const toggleMenuElement = document.getElementById('js-toggle-menu');
const menuElement = document.getElementById('js-menu');
const privacyPolicy = document.getElementById('privacy-policy');
const privacyPolicyBox = document.getElementById('privacy-policy-box');
const year = new Date().getFullYear();
document.getElementById('year').innerHTML = year;
if (document.cookie.split('privacy=')[1] !== "true") {
privacyPolicyBox.style.display = "flex";
}
toggleMenuElement.addEventListener('click', function () {
menuElement.classList.toggle('visible');
toggleMenuElement.classList.toggle('mdi-menu');
toggleMenuElement.classList.toggle('mdi-close');
});
privacyPolicy.addEventListener('click', () => {
document.cookie = "privacy=true; SameSite=None; Secure";
privacyPolicyBox.style.display = "none";
})
const breakpoint = window.matchMedia('(min-width: 768px)');
breakpoint.addEventListener('change', function (event) {
if (event.matches) {
menuElement.classList.remove('visible');
}
});