Present images, content and videos within lightboxes.

In this article

Our themes fully support the fancybox plugin, a responsive, touch-enabled lightbox plugin that supports various types of media.

Current versions of our themes allow you to enable lightbox functionality throughout the Help Center using theme settings. Once enabled, you can use data attributes on your images and other multimedia to display them within lightboxes.


The fancybox plugin requires jQuery, which isn’t included in our themes by default. Add references to the latest jQuery and fancybox files in your document_head.hbs template:

<!-- jQuery 3.5.1 -->
<script src=""></script>

<!-- fancybox 3.5.7 -->
<script src=""></script>
<link rel="stylesheet" href="" />


Lightbox functionality can be used in your page templates or in article and post content by editing the underlying code in the Source Code (Code icon) editor.

Using data attributes

The most basic way to use fancybox is to add the data-fancybox attribute to your element and specify the source of your content with the href or data-src attributes:

<a href="image.jpg" data-fancybox data-caption="Caption for single image">
  <img src="thumbnail.jpg" alt="" />

If data attributes are used, you will need to ensure that the allow unsafe HTML setting is enabled within Guide.

Using JavaScript

Use jQuery to select your element(s) and call the fancybox method:

  // Options will go here

If you need to bind fancybox to dynamically added elements, use the selector option to attach a click event listener for elements that exist now or in the future.

  selector : '.imglist a:visible'


Single images

Present images using fancybox using a thumbnail image that links to a larger image:

<a href="image.jpg" data-fancybox data-caption="An image within a lightbox">
  <img src="thumbnail.jpg" alt="" />

Image galleries

You can group images into a gallery by giving them the same unique data-fancybox value:

<a href="image-1.jpg" data-fancybox="gallery" data-caption="Caption for the first image">
  <img src="thumbnail-1.jpg" alt="" />

<a href="image-2.jpg" data-fancybox="gallery" data-caption="Caption for the second image">
  <img src="thumbnail-2.jpg" alt="" />


YouTube, Vimeo and HTML5 videos can be used with fancybox by providing the URL.

<a data-fancybox href="">
  <img src="thumbnail.jpg">

To learn about additional media types, access descriptions of more advanced use cases and view the complete set of available options, refer to the fancybox documentation.