Skip to content

Commit 8e2b96d

Browse files
authored
Merge pull request #244 from honeylogic-io/add-zoom-in-for-imges
feat(blog): Add zoomin for images
2 parents 8ba9f1a + f79a91d commit 8e2b96d

File tree

2 files changed

+23
-2
lines changed

2 files changed

+23
-2
lines changed

Dockerfile

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,7 @@ EOF
2525

2626
WORKDIR /app/
2727

28-
# hadolint ignore=DL3013
29-
RUN pip install pip poetry==1.4.2 #!COMMIT
28+
RUN pip install pip poetry==1.8.3
3029
COPY pyproject.toml poetry.lock /app/
3130
RUN poetry config virtualenvs.create false && poetry install --no-interaction #!COMMIT
3231

django_wtf/templates/wagtail_code_blog/blog_page.html

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,25 @@
1010
{% include "wagtail_code_blog/blog_page_body.html" %}
1111
</div>
1212
{% endblock content %}
13+
{% block js %}
14+
{{ block.super }}
15+
<script src="https://cdnjs.cloudflare.com/ajax/libs/medium-zoom/1.0.6/medium-zoom.min.js"
16+
integrity="sha512-N9IJRoc3LaP3NDoiGkcPa4gG94kapGpaA5Zq9/Dr04uf5TbLFU5q0o8AbRhLKUUlp8QFS2u7S+Yti0U7QtuZvQ=="
17+
crossorigin="anonymous"
18+
referrerpolicy="no-referrer"></script>
19+
<script>
20+
const images = Array.from(document.querySelectorAll(".prose img"));
21+
console.log(images)
22+
images.forEach(img => {
23+
mediumZoom(img, {
24+
margin: 0,
25+
/* The space outside the zoomed image */
26+
scrollOffset: 40,
27+
/* The number of pixels to scroll to close the zoom */
28+
container: null,
29+
/* The viewport to render the zoom in */
30+
template: null /* The template element to display on zoom */
31+
});
32+
});
33+
</script>
34+
{% endblock js %}

0 commit comments

Comments
 (0)