Skip to content

Commit 70887cd

Browse files
committed
Add <img> handling to show full size image on click, similar to image shortcode
1 parent 165c277 commit 70887cd

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

assets/css/index.css

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -579,6 +579,11 @@ html {
579579
scrollbar-gutter: stable;
580580
}
581581

582+
/* Auto-clickable for standalone images */
583+
img:not(a img):not(.image-card-img):not([src*="#no-click"]) {
584+
cursor: pointer;
585+
}
586+
582587
/* Chroma syntax highlighting */
583588

584589
/* Background */

static/js/index.js

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,4 +184,17 @@ const mobileMenu = (() => {
184184
document.addEventListener('click', clickHandler, false)
185185
document.addEventListener('keydown', keyHandler, false)
186186

187-
})()
187+
})()
188+
189+
// Simple click-to-open for standalone images
190+
document.addEventListener('click', function(e) {
191+
// Check if clicked element is a standalone img (not inside an anchor, not image-card, not no-click)
192+
if (e.target.tagName === 'IMG' &&
193+
!e.target.closest('a') &&
194+
!e.target.classList.contains('image-card-img') &&
195+
!e.target.src.includes('#no-click')) {
196+
197+
// Open image in same tab, just like clicking a regular link
198+
window.location.href = e.target.src
199+
}
200+
})

0 commit comments

Comments
 (0)