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 621 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..

Pro
Centered Image Logo in Bricks

Centered Image Logo in Bricks

Updated on 8 Mar 2023 This Pro tutorial provides the steps to add a logo image as the center menu item that shrinks when the…
Categories:
Pro
Oxygen’s Focus Section in Bricks

Oxygen’s Focus Section in Bricks

These are the steps to implement Focus Section, an Oxygen’s composite element, in Bricks.
Categories:
Pro
Sticky Scrolling in Bricks Builder

Sticky Scrolling in Bricks Builder

Updated on 22 Apr 2024 This Pro tutorial provides the steps to fix elements in the viewport i.e., make them sticky while adjacent content in the section…
Categories:
Tags:
Pro
Dropdown Menu in Bricks using Interactions

Dropdown Menu in Bricks using Interactions

This Pro tutorial provides the steps to toggle a WordPress menu when a div is clicked using the Interactions feature in Bricks. When clicked: Step…
Categories:
Useful Action Hooks in Bricks

Useful Action Hooks in Bricks

Bricks has a few handy action hooks to inject/add code in various areas of your site. Here are commonly-used ones.
Categories:
Tags:
How to create filters with IsotopeJS in Bricks (Part 2): Dynamic Image Galleries

How to create filters with IsotopeJS in Bricks (Part 2): Dynamic Image Galleries

This tutorial series will review how to create a dynamic filterable image gallery using the IsotopeJS library‘s features in Bricks. Requirements Create a custom taxonomy for your…
Pro
Meta Box/ACF Images Staggered Grid Gallery in Bricks

Meta Box/ACF Images Staggered Grid Gallery in Bricks

Showing images from two Gallery-type of ACF or Image Advanced-type of Meta Box fields in a staggered grid layout.
Pro
“Pro” Category Ribbon for Posts in Bricks

“Pro” Category Ribbon for Posts in Bricks

This Pro tutorial provides the steps to show a "Pro" ribbon for posts that are categorized under the "Pro" category when using Bricks builder. Step…
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: