-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathadaptive.js
More file actions
30 lines (28 loc) · 1.2 KB
/
adaptive.js
File metadata and controls
30 lines (28 loc) · 1.2 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
function openMenu() {
document.getElementById("mySidebar").style.display = "block";
document.getElementById("myOverlay").style.display = "block";
}
function closeMenu() {
document.getElementById("mySidebar").style.display = "none";
document.getElementById("myOverlay").style.display = "none";
}
function openDialogs() {
document.getElementById("myDialogs").style.display = "block";
document.getElementById("left").style.display = "none";
}
// Дополнительно: сравнение с размером экрана, чтобы закрытие диалогов при нажатии на контакт
// реагировало только для маленьких экранах
function closeDialogs() {
function myFunction(x){
if (x.matches) {
document.getElementById("myDialogs").style.display = "none";
document.getElementById("left").style.display = "block";
} else {
document.getElementById("myDialogs").style.display = "block";
document.getElementById("left").style.display = "none";
}
}
var x = window.matchMedia("(max-width: 769px)");
myFunction(x);
x.addListener(myFunction);
}