Skip to content
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

images: wrap images in a lightbox #63

Merged
merged 4 commits into from
Jan 13, 2025
Merged

images: wrap images in a lightbox #63

merged 4 commits into from
Jan 13, 2025

Conversation

l-zeuch
Copy link
Collaborator

@l-zeuch l-zeuch commented Jan 11, 2025

Wrap images in a lightbox, increasing them to full-screen size when
clicked. There are JavaScript solutions available (e.g. lightbox2)1,
though I opted for a purely CSS-based approach.2

We can further modify the link render hook such that wrapping the image
in question is optional—perhaps this is sensible for rather small
images? What do you think?

Local testing reveals no issues; it may be worth testing on a mobile
device or viewport as well.

Signed-off-by: Luca Zeuch l-zeuch@email.de

Terms

Footnotes

  1. https://lokeshdhakar.com/projects/lightbox2/

  2. https://codesalad.dev/blog/how-to-create-an-image-lightbox-in-pure-css-25

Wrap images in a lightbox, increasing them to full-screen size when
clicked. There are JavaScript solutions available (e.g. lightbox2)[^0],
though I opted for a purely CSS-based approach.[^1]

[^0]: https://lokeshdhakar.com/projects/lightbox2/
[^1]: https://codesalad.dev/blog/how-to-create-an-image-lightbox-in-pure-css-25

Signed-off-by: Luca Zeuch <l-zeuch@email.de>
@l-zeuch
Copy link
Collaborator Author

l-zeuch commented Jan 11, 2025

Sidenote: Perhaps we should also explore lazy loading, because the implementation requires rendering the image in question twice. I will implement this in a future commit, potentially alongside the option to not wrap an image in a lightbox.

The implementation of a lightbox requires that the image in question is
rendered twice, once in the actual content and a second time as an
off-screen image. Defer loading of that off-screen duplicate until it is
needed.

Signed-off-by: Luca Zeuch <l-zeuch@email.de>
Authors can now pass `lightbox=false` as a query parameter with their
image URL to disable the lightbox effect; this is especially useful for
smaller images that do not have a lot of detail.

Signed-off-by: Luca Zeuch <l-zeuch@email.de>
Signed-off-by: Luca Zeuch <l-zeuch@email.de>
@SoggySaussages
Copy link
Contributor

-evalcc {{ addReactions "soundsgoodtome:1326889055668932659" }}

@l-zeuch
Copy link
Collaborator Author

l-zeuch commented Jan 13, 2025

I'm going to deploy this now--if necessary, we can disable the lightbox on select images in a future commit.

@l-zeuch l-zeuch merged commit 2017ab4 into master Jan 13, 2025
4 checks passed
@l-zeuch l-zeuch deleted the lightbox branch January 13, 2025 10:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants