Caption in Gallery Lightbox

Description:

  • Enable caption in Gallery Lightbox

#1. Install code

#1.1. Personal Plan/Basic Plan

First, add a section under Gallery (or you can also add a section in Site Footer)

Caption in gallery lightbox 1

Add a Block > Choose Markdown

Caption in gallery lightbox 2

Paste this code into Markdown

<script src="https://code.beaverhero.com/gallerys/captionlb.js"></script>

Caption in gallery lightbox 3

Next, use this code to Custom CSS

/* @tuanphan - Lightbox caption */
div.light-caption {
    opacity: 0;
    font-size: 14px;
    margin: 0;
    background-color: rgba(255, 255, 255, 1);
    color: #000;
    width: 100%;
    padding: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 20px;
    z-index: 9999;
    transition: opacity 0.15s ease;
}

Caption in gallery lightbox 4

#1.2. Business Plan/higher

Hover on page where you use Gallery > Click Gear icon

Caption in gallery lightbox 5

Next, click Advanced > Paste this code

<!-- @tuanphan - Lightbox Caption -->
<script src="https://code.beaverhero.com/gallerys/captionlb.js"></script>
<style>
div.light-caption {
    opacity: 0;
    font-size: 14px;
    margin: 0;
    background-color: rgba(255, 255, 255, 1);
    color: #000;
    width: 100%;
    padding: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 20px;
    z-index: 9999;
    transition: opacity 0.15s ease;
}
</style>

Caption in gallery lightbox 6

#2. Usage

Make sure you enabled Caption + Lightbox

Caption in gallery lightbox 7

Make sure you added caption to Images

Caption in gallery lightbox 8

#3. Customize

#3.1. To remove caption under image in Gallery View, we can use this code to Custom CSS

figcaption.gallery-caption {
    display: none;
}

Caption in gallery lightbox 9

But if you want to remove caption in current page only, you can add this code into Markdown Block

<style>
  figcaption.gallery-caption {
    display: none;
}
  </style>

Caption in gallery lightbox 10

Or Page Header Injection

<style>
  figcaption.gallery-caption {
    display: none;
}
</style>

Caption in gallery lightbox 11

#3.2. To change style of lightbox caption, you can adjust these lines

div.light-caption {
    opacity: 0;
    font-size: 14px;
    margin: 0;
    background-color: rgba(255, 255, 255, 1);
    color: #000;
    width: 100%;
    padding: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 20px;
    z-index: 9999;
    transition: opacity 0.15s ease;
}

Caption in gallery lightbox 6

Buy me a coffee