This commit is contained in:
2026-10-17 14:40:21 +07:00
parent e9a6814ebb
commit 00bd14bac1
7 changed files with 122 additions and 6 deletions
+15
View File
@@ -0,0 +1,15 @@
const motionToggle = document.getElementById('motion-toggle');
const reducedMotion = window.matchMedia('(prefers-reduced-motion: reduce)');
function setMotionPaused(isPaused) {
document.documentElement.classList.toggle('motion-running', !isPaused);
motionToggle.setAttribute('aria-pressed', String(isPaused));
motionToggle.textContent = isPaused ? 'Запустить механизмы' : 'Остановить механизмы';
}
setMotionPaused(reducedMotion.matches);
motionToggle.hidden = false;
motionToggle.addEventListener('click', () => {
setMotionPaused(document.documentElement.classList.contains('motion-running'));
});
reducedMotion.addEventListener('change', event => setMotionPaused(event.matches));