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 626 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 a Reply to Frans (Cancel Reply)

 

Related Tutorials..

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:
Pro
Team Member Photos Stack with Hover Tooltips in Bricks

Team Member Photos Stack with Hover Tooltips in Bricks

Herman Baiatian shared in the Bricks Facebook group here that he worked on overlapping team member headshots showing info in hover tooltips. I recreated it…
Categories:
Create a App-Like Navigation in Bricks

Create a App-Like Navigation in Bricks

I've promised a few folks in the Facebook group to create a tutorial on how to create an app-like navigation in Bricks like in the…
Categories:
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:
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:
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:
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:
Pro
Ken Burns Background Slideshow in Bricks

Ken Burns Background Slideshow in Bricks

Setting up a hero section, having images that pan and move as a background slideshow with content on top.
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: