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

Pop up image when clicked #65

Closed
iAmG-r00t opened this issue Aug 14, 2022 · 6 comments
Closed

Pop up image when clicked #65

iAmG-r00t opened this issue Aug 14, 2022 · 6 comments
Assignees
Labels
Question Questions asked from the visitors

Comments

@iAmG-r00t
Copy link

@LazyRen quick question, so most blogs I write require images for an explanation. The issue is the images show pretty small texts on the site and I was thinking is there a way to make images pop up once they have been clicked to give someone an opportunity to zoom and read the contents of the image better?

@LazyRen LazyRen added the Question Questions asked from the visitors label Aug 15, 2022
@LazyRen
Copy link
Owner

LazyRen commented Aug 15, 2022

Well, it seems Hydejack theme does not provide such extension, but there are Lightbox2 / Magnific Popiop and others that can be used with Jekyll.

I'll let you know if I enable one in near future. It seems a good feature to have.

@iAmG-r00t
Copy link
Author

Okay, I will be waiting 😄

@LazyRen
Copy link
Owner

LazyRen commented Aug 26, 2022

A little hack you can use is to wrap up the image with the link to the image again. So it links to the image itself when clicked, which is zoomable. Not pretty, but easy.

[![img](/images/test_img.jpg)](/images/test_img.jpg)

@LazyRen
Copy link
Owner

LazyRen commented Aug 26, 2022

lightbox plugin is also very easy to install. You only need to add two files (follow the instruction), and add below code snippets.

<!-- file: _include/head/scripts.html -->
{% if site.lightbox %}
  <script type="text/javascript" src="/assets/js/lightbox.js"></script>
{% endif %}
<!-- file: _include/head/link-static.html -->
{% if site.lightbox %}
  <link rel="stylesheet" href="/assets/css/lightbox.css">
{% endif %}

The downside is that you still have to create link with below syntax and most importantly popup image is just the same size as the original one from the post. Therefore I see no reason to use this extension for myself...

[![img](/images/test_img.jpg)](/images/test_img.jpg)

The best way would be to go with the photoswipe but it requires for you to set width/height of the all images and need to write down image in their syntax. I wish to keep the syntax of the markdown ![img](/images/test_img.jpg), which requires some tweak with the javascript I guess...

Not really an expert nor a fan of JS, so I'm not sure I'll be working on this further. I'll make sure to let you know if I ever do this.

@LazyRen LazyRen closed this as completed Aug 26, 2022
@iAmG-r00t
Copy link
Author

Okay, I will try each of the provided solutions I see. But what would you recommend currently before finding a way with photoswipe?

@LazyRen
Copy link
Owner

LazyRen commented Aug 27, 2022

Done the implementation. I chose lightbox plugin because it looked easy to apply. I had to modify it a bit but it works pretty well. Check out my blog for the result & #67 for the actual change. It won't be hard for you to apply this to your blog.
The post also might help.
Wish you luck and thank you for a great feature suggestion :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Question Questions asked from the visitors
Projects
None yet
Development

No branches or pull requests

2 participants