Skip to content

feat(blog): Add zoomin for images #244

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ EOF

WORKDIR /app/

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

Expand Down
22 changes: 22 additions & 0 deletions django_wtf/templates/wagtail_code_blog/blog_page.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,25 @@
{% include "wagtail_code_blog/blog_page_body.html" %}
</div>
{% endblock content %}
{% block js %}
{{ block.super }}
<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>
<script>
const images = Array.from(document.querySelectorAll(".prose img"));
console.log(images)
images.forEach(img => {
mediumZoom(img, {
margin: 0,
/* The space outside the zoomed image */
scrollOffset: 40,
/* The number of pixels to scroll to close the zoom */
container: null,
/* The viewport to render the zoom in */
template: null /* The template element to display on zoom */
});
});
</script>
{% endblock js %}
Loading