feat(settings): Settings-Panel und Theme-Picker mit View-Transition-Fade
This commit is contained in:
+24
-4
@@ -3,24 +3,44 @@
|
|||||||
Settings Panel, Theme-Modal, Accordion, Toggles
|
Settings Panel, Theme-Modal, Accordion, Toggles
|
||||||
============================================= */
|
============================================= */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fuehrt einen DOM-Mutationsschritt mit nativem View-Transition-Fade aus.
|
||||||
|
* Feature-Detection-Fallback fuer aeltere Browser (Firefox < 144): instant.
|
||||||
|
* reduced-motion kappt das Fade ueber den ungeschichteten @media-Block.
|
||||||
|
* @param {Function} mutate - synchrone DOM-Mutation (Klassen-Toggle etc.)
|
||||||
|
*/
|
||||||
|
function withViewTransition(mutate) {
|
||||||
|
if (document.startViewTransition) {
|
||||||
|
document.startViewTransition(mutate);
|
||||||
|
} else {
|
||||||
|
mutate();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// ---- SETTINGS PANEL ----
|
// ---- SETTINGS PANEL ----
|
||||||
function openSettings() {
|
function openSettings() {
|
||||||
|
withViewTransition(() => {
|
||||||
document.getElementById('settingsPanel').classList.add('open');
|
document.getElementById('settingsPanel').classList.add('open');
|
||||||
document.getElementById('settingsOverlay').classList.add('active');
|
document.getElementById('settingsOverlay').classList.add('active');
|
||||||
|
});
|
||||||
}
|
}
|
||||||
function closeSettings() {
|
function closeSettings() {
|
||||||
|
withViewTransition(() => {
|
||||||
document.getElementById('settingsPanel').classList.remove('open');
|
document.getElementById('settingsPanel').classList.remove('open');
|
||||||
document.getElementById('settingsOverlay').classList.remove('active');
|
document.getElementById('settingsOverlay').classList.remove('active');
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// ---- THEME MODAL ----
|
// ---- THEME MODAL ----
|
||||||
function openThemeModal() {
|
function openThemeModal() {
|
||||||
const overlay = document.getElementById('themeOverlay');
|
withViewTransition(() => {
|
||||||
overlay.classList.add('active');
|
document.getElementById('themeOverlay').classList.add('active');
|
||||||
|
});
|
||||||
}
|
}
|
||||||
function closeThemeModal() {
|
function closeThemeModal() {
|
||||||
const overlay = document.getElementById('themeOverlay');
|
withViewTransition(() => {
|
||||||
overlay.classList.remove('active');
|
document.getElementById('themeOverlay').classList.remove('active');
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user