21st Jul '22
/
11 comments

Button to Open Bricks Gallery

Button to Open Bricks Gallery

Updated on 5 Apr 2024

This Pro tutorial provides the steps to trigger a click on the first image of a gallery in Bricks when a button is clicked.

We are going to set a fixed height for the gallery with overflow: hidden so that only a few images will be shown and the user can either click on any of the images or on the "View All Photos" button and browse all of them in the lightbox.

Step 1

Edit your Template/Page with Bricks.

Add a Section.

Set Section's Container's position to relative.

Add a Image Gallery element inside the Section's container.

Select/upload your desired images or if you have a ACF Gallery field or Meta Box Advanced Image field set up, select it as the source of images.

Link to: Lightbox.

STYLE → LAYOUT: Set a Max. height (534px in my test site).

Overflow: hidden

Step 2

Add a Button element below the Image Gallery.

Position: AbsoluteRight: 10pxBottom: 10px

Step 3

Click on the Settings (gear) icon → PAGE SETTINGS → CUSTOM CODE and paste the following under Body (footer) scripts:

This is a BricksLabs Pro tutorial.

For full access login below or create your BricksLabs Pro account

Get access to all 633 Bricks code tutorials with BricksLabs Pro

Related Tutorials..

Pro
Configuring Image Gallery dynamic source in Bricks

Configuring Image Gallery dynamic source in Bricks

Let's say you have a custom field created with ACF Pro of the type Gallery called "Property Gallery" for posts of "Property" CPT. In the…
Pro
Conditionally Hiding Bricks Filters based on Select Filter Value

Conditionally Hiding Bricks Filters based on Select Filter Value

How show or hide Bricks' filter based on the selection made by another filter.
Categories:
Tags:
Pro
Limiting the Number of Images in Bricks Image Gallery Element

Limiting the Number of Images in Bricks Image Gallery Element

How we can use Bricks' render_tag() as a simpler way to limit the image count in any Gallery element.
Pro
ACPT Gallery Field Query Loop in Bricks

ACPT Gallery Field Query Loop in Bricks

How we can output images from ACPT‘s Gallery field for posts as a grid using a query loop.
Categories:
Adding Icon on Gallery Images in Bricks

Adding Icon on Gallery Images in Bricks

When lightbox is enabled for the images in Image Gallery element, it is probably a good idea to add a visual indicator to tell the…
Categories: