• Resolved jason9j

    (@jason9j)


    Hi

    With an image block in Gutenberg, I simply want the enlarged image to be viewable in a lightbox. Is there a simple functions snippet I can add so I can add a simple CSS class to an img to achieve this?

    Is there a native WP function that can be triggered with a functions snippet? If not, is there a super lightweight, free and open source, up-to-date vanilla solution? Surely this can be done without heavy plugins and eternal software subscriptions?

    I’d really appreciate any thoughts on this. I have spent a lot of time trying to find a solution, but I haven’t found the simple, verified solution I’m after. I try to keep everything as integrated with native Gutenberg functionality as I possibly can…

    • This topic was modified 2 years ago by Jan Dembowski. Reason: Moved to Fixing WordPress, this is not an Everything else WordPress topic
Viewing 2 replies - 1 through 2 (of 2 total)
  • Moderator bcworkz

    (@bcworkz)

    You could modify content to include modals for applicable images. Probably as custom HTML. You’re basically manually doing what a lightbox plugin would do for you automatically.

    To do lightbox automatically, you really need an appropriate plugin. To have a lightweight plugin to do this, a custom plugin could be developed that fits your specific need, without all the options and flexibility that existing plugins typically offer, along with undesired complexity. A lightweight plugin could be built around the immediate descendant of the original lokesh lightbox script.

    Thread Starter jason9j

    (@jason9j)

    Thanks @bcworkz.

    First I apologize for the late reply – I didn’t realize there had been a response to my post.

    Yes, I have concluded that you are absolutely right – a lightweight plugin is preferable. I found a couple. I’d rather only use plugins that extend Gutenberg’s native way of doing things, even if limited.

    Thanks for pointing out how I could go about doing it myself directly, though. I guess if development stops on any of the current plugins, I will know where to start.

    Many thanks again.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Simple function to show image in a lightbox?’ is closed to new replies.