Better product gallery lightbox with Oxygen and Fancybox

Author: Aleš Sýkora, 18. 1. 2021

I will show you, how I am creating galleries like this (open random car to see it) in Oxygen Builder. I hate the product builder and default behavior of WooCommerce lightbox and magnifying glass function on hover.

Gallery has more than 50 images, but you can see only main image + 8 thumbnails on frontend

So I am using Image block wrapped in link - for featured image. And Oxygen's gallery block for rest of images. It's usable fwith ACF gallery, alsowith your custom gallery from selected images and finally with WooCommerce product images too!

For image URL I am using dynamic data - featured image. For link wrapping over image too.

What's also needed is 3rd party script - fancybox for image lightbox. You can use My custom funcionality plugin or you can just put those lines in Code block PHP section.

<!-- Load the fancybox css and js files -->
<link href="//" rel="stylesheet">
<script src="//"></script>

Then you need to got some CSS and JS to work. Here are styles for hiding the images and displaying the "More images" text over last visible image.

a.oxy-gallery-item:nth-of-type(1n+9) {  
 /*hiding the rest of gallery images*/

a.oxy-gallery-item:nth-of-type(n+8) figure::after {
  content: "More images";
 /*Text on last visible image*/
  position: absolute;
 /*Positioning the text*/
  z-index: 9;

@media only screen and (max-width:650px) {
  a.oxy-gallery-item:nth-of-type(n+8) figure::after {

And finally put this javascript to code block. Don't forget to change the link ID, to your link wrapper overlapping featured mage.

You can also change the "car-gallery" to anything else. It is just saying, that those elements should be displayed in same lightbox.

(function($) {
'use strict';

	$('.oxy-gallery-item').attr('data-fancybox', 'car-gallery');
	$('#link-231-15' ).attr('data-fancybox', 'car-gallery'); 


Thats it :-).