Custom Lightbox - modern, swipe gestures, fullscreen mode and more

Hello :wave:

This theme component is modify the magnific popup (lightbox/gallery) to make it more user friendly especially on mobile.


This component will make a lot of changes on the default magnific popup.

  • More modern design
  • Fullscreen button (shortcut F key)
  • Show/hide title button
  • Touch swipe gestures
    • swipe right - previous image
    • swipe left - next image
    • swipe down - close lightbox

Theme translations to change the buttons title.

zoom_in_button_title: "Zoom In"
zoom_out_button_title: "Zoom Out"
close_button_title: "Close (Esc)"
fullscreen_button_title: "Fullscreen mode (F)"
toggle_title_button_title: "Toggle Info"

This new custom lightbox, inspired by New Discourse Lightbox Enabled on Meta - now disabled


Still want to use the old version?
You can with the old-custom-lightbox branch.

14 Likes

Would be great if scrolling could be done by swipe left right. Besides that, great tc.

3 Likes

Thanks! Yes that would be great but unfortunately Magnific Popup doesn’t support swipe gestures.

4 Likes

I have updated the theme component and the OP.

4 Likes

Hello :wave:

I’ve updated this theme component :tada:

This update contains the following:

  1. Drop jQuery
  2. Change the theme-color to black when the lightbox opens. (e.g. the status bar will also be black as the lightbox background)
  3. Update to FontAwesome 6 icons.
  4. Use zoom-in and zoom-out cursors on image.

I’ve added a preview link to the OP. :slightly_smiling_face:

5 Likes

Very nice Don, any chance you could add an option to push the arrows, download button and image count to the outside of the image? On a photography site it’s not good to cover up parts of the photo, we want to see the entire photo without distractions. No worries if not, thanks!

2 Likes

Thanks David, I will looking into a solution :slightly_smiling_face:

The idea is create a new info button to show/hide the image informations such as download, original image, title and counter maybe. :thinking:

1 Like

Thanks Don, I was thinking more like this:

But also move the arrows outside of the image, it would require the image being smaller to have some padding around the edges for this.

The other option would be hiding all the information until the cursor moves, not sure if that’s possible.

2 Likes

I’ve got some inspiration from how it arranges with the new lightbox and I made a concept :sweat_smile:

I think something like this probably can works.


  1. simplify buttons, change positions, smaller arrows
  2. add fullscreen button and info button to show bottom infos
1 Like

Love it! Hope you can make it work :crossed_fingers:t3:

2 Likes

Here is the update for this theme component :tada: It’s not merged yet but you can try how it works on Theme Creator.

Changes like I mentioned in this Custom Lightbox - modern, swipe gestures, fullscreen mode and more - #9 by Don post.

  1. Fullscreen button (you can trigger it with F key too)
  2. Show/hide title button
  3. Only show zoom-out icon when you zoomed in.
  4. Hide arrows on mobile
  5. Also added touch swipe actions to make it more comfortable to use on touchscreen devices.
    • swipe right - previous image
    • swipe left - next image
    • swipe down - close lightbox
  6. Some UX tweaks

This update will also removes the settings.

2 Likes

Looks nice Don! The only issue I’m seeing is when I click the prev/next arrows it closes the lightbox, if you use the keyboard arrows it does work as expected. I tried various browsers and it does the same thing.

2 Likes

Thanks, I fixed it now. Can you check it?

1 Like

Working now!

2 Likes

Hello :wave:

I’ve merged the new custom lightbox :tada:

Updated the OP too…

3 Likes