Skip to content

Commit d48d969

Browse files
committed
Zooming image on click with medium-zoom lib.
1 parent b5ff9eb commit d48d969

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<script src="https://cdnjs.cloudflare.com/ajax/libs/medium-zoom/1.0.6/medium-zoom.min.js" integrity="sha512-N9IJRoc3LaP3NDoiGkcPa4gG94kapGpaA5Zq9/Dr04uf5TbLFU5q0o8AbRhLKUUlp8QFS2u7S+Yti0U7QtuZvQ==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
2+
3+
<script>
4+
const images = Array.from(document.querySelectorAll(".post-content img"));
5+
images.forEach(img => {
6+
mediumZoom(img, {
7+
margin: 0, /* The space outside the zoomed image */
8+
scrollOffset: 40, /* The number of pixels to scroll to close the zoom */
9+
container: null, /* The viewport to render the zoom in */
10+
template: null /* The template element to display on zoom */
11+
});
12+
});
13+
</script>

0 commit comments

Comments
 (0)