Horizontal Scrolling Sections in Bricks Using GSAP’s ScrollTrigger

Horizontal Scrolling Sections in Bricks Using GSAP’s ScrollTrigger

In this Pro tutorial we'll use GSAP's ScrollTrigger library in Bricks to create a section that will scroll horizontally across a number of full width containers as the user scrolls down the page. This can be used on multiple sections on a page.

For the tutorial, we'll use Bricks' Query Loop feature to fetch a few posts with the container element and have these as the content that is inside the horizontal scrolling section. The effect is turned off for <992px (tablet portraight), where the posts are then stacked instead, this can be easily changed.

Demo

Page Export

An export file of the demo page is provided at the end.

Creating the Structure in Bricks

The demo page has a fairly simple structure, consisting of just three main sections. The top and bottom sections are just regular sections (container element) to show where other content would be on the page and can be ignored. The second section is where all of the horizontal scrolling is implemented. This is our horizontal scroll container, which we'll give the class 'horizontal-scroll-container' so we can apply some CSS later.

If we were creating two horizontal scrolling sections on the same page, we'd just create the same structure for that section and give it the same 'horizontal-scroll-container' class.

We can see from the structure, there's only one container inside of the horizontal scroll section, our 'post container'. This is being duplicated by the Query Loop feature to output three posts. If we weren't using the Query loop, we'd just add more containers manually inside of the section and add in the content.

This is a BricksLabs Pro tutorial.

For full access login below or create your BricksLabs Pro account

Get access to all 526 Bricks code tutorials with BricksLabs Pro

Related Tutorials..

Pro
CSS Grid for Posts Element in Bricks

CSS Grid for Posts Element in Bricks

The "Posts" element in Bricks has "Grid" as the default layout but the actual CSS it applies on the page feels hacky with negative margins…
Categories:
Floating Element in Bricks

Floating Element in Bricks

How to create a floating element in Bricks that appears across the entire website.
Categories:
Tags:
How to populate a map with dynamic markers from a CPT using ACF in Bricks (PART 2)

How to populate a map with dynamic markers from a CPT using ACF in Bricks (PART 2)

This tutorial provides the PHP & JS codes that can be pasted in order to create a flying effect on map markers each time your…
Pro
Horizontal Scrolling Tabs in Bricks

Horizontal Scrolling Tabs in Bricks

Nestable Tabs element in Bricks wraps into multiple lines out of the box at smaller viewport widths. This Pro tutorial provides the steps to remove…
Categories:
Tags:
How to add SVG icon as list item bullets

How to add SVG icon as list item bullets

Add this sample CSS: Replace brxe-list with the class of your ul element. Here's how you can generate the value of background-image property: Copy your…
Categories:
Tags:
Animated Border Hover Effect Buttons

Animated Border Hover Effect Buttons

Here's how can be implemented in HTML/WordPress/Bricks. Step 1 Add this CSS in your child theme's style.css or another appropriate location: Step 2 Add a…
Categories:
How to animate notations on scroll using RoughNotation.js in Bricks

How to animate notations on scroll using RoughNotation.js in Bricks

This tutorial provides the PHP & JS codes that can be pasted in order to animate notations on scroll using the RoughNotation library inside the Bricks Builder.
Categories:
Pro
Inserting Random Ad Between Posts in Bricks

Inserting Random Ad Between Posts in Bricks

How to insert random ads (post type) in between regular posts on the blog page.
Categories:
Pro
Stripe’s Animated Gradient in Bricks

Stripe’s Animated Gradient in Bricks

This Pro tutorial provides the steps to set up an animated gradient as a background of a section in Bricks using the code generated by…
Categories: