feat(docs): click-to-fullscreen for all article images

This commit is contained in:
pj committed 2026-04-23 00:41:48 +07:00
1 parent 86e42c468d
commit a8fd4de1af
2 files changed
+11

No files matched your search

+1
View File
@@ -132,6 +132,7 @@ main article img {
display: block;
margin: 1.25rem 0;
border-radius: 4px;
cursor: zoom-in;
}
a { color: var(--accent); }
+10
View File
@@ -84,6 +84,16 @@ for (const diagram of document.querySelectorAll('.mermaid')) {
});
}
for (const img of document.querySelectorAll('article img')) {
img.addEventListener('click', () => {
overlay.innerHTML = '';
const clone = img.cloneNode();
clone.style.cssText = 'max-width:95vw;max-height:95vh;width:auto;height:auto;border-radius:6px;';
overlay.appendChild(clone);
overlay.classList.add('open');
});
}
document.getElementById('theme-toggle').addEventListener('click', () => {
const next = document.documentElement.dataset.theme === 'dark' ? 'light' : 'dark';
document.documentElement.dataset.theme = next;