13th Feb '24
/
2 comments

Floating Element in Bricks

Floating Element in Bricks

In Bricks Facebook group a user asks:

If I have a floating element to show on each pages, cpt, articles… of the site, in wich template should I join it ? In oxygen I would have place it in the main… but with bricks?

Bricks offers a lot of flexibility, which means there are many ways of doing this. But the ideal way to set up a floating element in Bricks, in my opinion, would be to simply add it to a Section-type template and hook this template to wp_footer.

Here’s how:

Go to Bricks → Templates.

Here’s the JSON export from our dev site if you want a head start (uses some ACSS variables). Ensure that the template settings are correctly set, as mentioned below.

If you want to build this manually, add a new template named say “Floating Content” of type “Section”.

Edit it with Bricks and build it as needed.

The main thing to note is that position: fixed is to be set for the outer-most wrapper element in the structure with (typically) right and bottom values.

Click the cog (Settings) icon → TEMPLATE SETTINGS → CONDITIONS.

Select “Entire website” (or any other view as desired).

and for the hook name, wp_footer

There are other Bricks hook locations that could be used like bricks_after_footer and bricks_after_site_wrapper but wp_footer should be the ideal one in this case based on the mantra I learnt from either Gary Jones or Tonya Mork:

Remember

Hook late. Return early.

Get access to all 625 Bricks code tutorials with BricksLabs Pro

2 comments

  • Great tip! What is the best way to make the "popup" dissmisable when clicked, and then have it not show up on page refresh?

    The popup functionality in Bricks Builder would be preferable, but it hijacks the screen.

Leave your comment

 

Related Tutorials..

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:
Pro
Filtering Masonry-layout Posts by Categories in Bricks using Isotope

Filtering Masonry-layout Posts by Categories in Bricks using Isotope

Step by step on how to use Isotope in Bricks for filtering posts by categories.
Categories:
Plain HTML pages in Bricks

Plain HTML pages in Bricks

How to output only raw HTML on the page with no other WordPress/Bricks (or any other active child/parent theme)/plugins baggage.
Floats in Bricks for Wrapping Text Around Images

Floats in Bricks for Wrapping Text Around Images

In the Bricks Facebook group a user asks: Float, left or right? Just a quick question. Am I going crazy or can't I specify a…
Categories:
Tags:
Pro
Bricks Query Loop Cards with Hover Image

Bricks Query Loop Cards with Hover Image

How images uploaded to posts can appear when the featured images in a Bricks posts query loop are hovered.
Categories:
How to add a resizable desktop navbar in Bricks

How to add a resizable desktop navbar in Bricks

This tutorial will show you how to add a "More" menu item when the navbar overflows on desktop.
Categories:
Tags:
How to create filters with IsotopeJS in Bricks (Part 1)

How to create filters with IsotopeJS in Bricks (Part 1)

This tutorial series will explore the IsotopeJS library's features inside the Bricks ecosystem.
Categories:
Width and Height of Mobile Hamburger Toggle in Bricks

Width and Height of Mobile Hamburger Toggle in Bricks

Looking to change the size of Bricks hamburger toggle in the mobile menu? The default width value of 20px can be changed by selecting the…
Categories: