Update index.html
Browse files- index.html +18 -10
index.html
CHANGED
@@ -930,21 +930,29 @@
|
|
930 |
});
|
931 |
|
932 |
// Обработчики для мобильных описаний
|
933 |
-
|
934 |
-
|
935 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
936 |
this.classList.toggle('active');
|
937 |
}
|
938 |
-
}
|
939 |
});
|
|
|
940 |
|
941 |
document.addEventListener('click', (e) => {
|
942 |
-
|
943 |
-
|
944 |
-
|
945 |
-
|
946 |
-
|
947 |
-
|
948 |
</script>
|
949 |
</body>
|
950 |
</html>
|
|
|
930 |
});
|
931 |
|
932 |
// Обработчики для мобильных описаний
|
933 |
+
document.querySelectorAll('.material-card').forEach(card => {
|
934 |
+
card.addEventListener('click', function(e) {
|
935 |
+
if (window.matchMedia("(max-width: 768px)").matches) {
|
936 |
+
// Проверяем что клик не внутри описания
|
937 |
+
if (!e.target.closest('.material-description')) {
|
938 |
+
// Закрываем все другие карточки
|
939 |
+
document.querySelectorAll('.material-card').forEach(c => {
|
940 |
+
if (c !== this) c.classList.remove('active');
|
941 |
+
});
|
942 |
+
// Переключаем текущую карточку
|
943 |
this.classList.toggle('active');
|
944 |
}
|
945 |
+
}
|
946 |
});
|
947 |
+
});
|
948 |
|
949 |
document.addEventListener('click', (e) => {
|
950 |
+
if (!e.target.closest('.material-card') && window.matchMedia("(max-width: 768px)").matches) {
|
951 |
+
document.querySelectorAll('.material-card').forEach(card => {
|
952 |
+
card.classList.remove('active');
|
953 |
+
});
|
954 |
+
}
|
955 |
+
});
|
956 |
</script>
|
957 |
</body>
|
958 |
</html>
|