Skip to content

Commit 03f1863

Browse files
committed
feat: add image zoom to improve image viewing experience
Signed-off-by: reidliu41 <reid201711@gmail.com>
1 parent 77f77a9 commit 03f1863

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

docs/mkdocs/javascript/image_zoom.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/**
2+
* Image Zoom
3+
* --------------
4+
* Enables smooth click-to-zoom for images using medium-zoom.
5+
* Skips images with `.no-zoom` class.
6+
*/
7+
8+
document$.subscribe(() => {
9+
mediumZoom('article img:not(.no-zoom)', {
10+
background: 'rgba(0, 0, 0, 0.8)',
11+
margin: 24,
12+
});
13+
});

mkdocs.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,8 @@ extra_javascript:
128128
- https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML
129129
- mkdocs/javascript/edit_and_feedback.js
130130
- mkdocs/javascript/slack_and_forum.js
131+
- https://cdn.jsdelivr.net/npm/medium-zoom@1.0.6/dist/medium-zoom.min.js
132+
- mkdocs/javascript/image_zoom.js
131133

132134
# Makes the url format end in .html rather than act as a dir
133135
# So index.md generates as index.html and is available under URL /index.html

0 commit comments

Comments
 (0)