Micro.blog

jayeless
jayeless
Did something I’ve been intending to do for a while, and added glightbox (external link) to this site so you can click any photos I post to see them at the highest resolution. Especially helpful if you visit on a mobile. I also put in per-post galleries, so if you’re already viewing a p... www.jayeless.net
jsonbecker
jsonbecker

@jayeless this is a good idea that I've added to my glightbox plug in. Here's how I did it.

alans
alans

@jayeless Looks good! You inspired me to finally (try to) re-add a lightbox back to my site, as well. I can't figure out why, for some reason glightbox isn't activating when I click an link+image with its class active. I think something is pre-empting it, but am not quite savvy enough to solve it.

jayeless
jayeless

@alans I took a peek at your HTML source code, and I think the missing piece of the puzzle is at the bottom of your page, you're missing a snippet that should go like:

<script type="text/javascript">
  const lightbox = GLightbox();
</script>

in order to run the script, and not just have it there available to be invoked 😅 I forgot to include that bit on my first attempt as well, and was pleased that it all started working as expected once I did. Hopefully that works for you too!

alans
alans

@jayeless Ohmygosh!! Yes, that was exactly it. This is the kind of trouble I run into by not actually knowing how javascript works 🤣. Thanks so much! Now I can get into even more trouble figuring out how to make gallery/grid displays, too. (Today has been fun, actually, making a number of small improvements and learning how to use the markdown render hooks.)

jayeless
jayeless

@alans You're welcome! I'm certainly not experienced with Javascript either, I just know that this was something that tripped me up as well 🤣 There's definitely a lot of fun to be had tinkering!