How to Add a Fixed Bubble Popup Link to Divi

aniaromanska

Written by Ania Romańska

Published on . Last edited on .

Fixed bubble popup link in the corner of a Divi website

TL;DR

The bubble popup is a div with the class dl-info-popup, added in Divi → Theme Options → Integration → Add code to the < body >, so it shows on every page.

Its CSS uses position: fixed; bottom: 20px; left: 20px; with a 150px by 150px size, a round link (border-radius: 50%) and a blurred gradient background animated with @keyframes.

The jQuery line $('.dl-info-popup').delay(2000).fadeIn(); shows the bubble after 2 seconds, and a click on .close fades it out; it works in Divi 5 because it is wrapped in jQuery(document).ready().

To hide the bubble on one page, use the page's body class: body.page-id-123 .dl-info-popup { display: none!important; }.

In Divi 5 you can build it with modules: a Group with Position Fixed, a Load + Show Element interaction with a 2000ms Time Delay, and a close Icon with Click → Hide Element → Parent Container.

Updated for Divi 5: I tested the HTML, CSS and jQuery from this tutorial in Divi 5.18, and the bubble works just like in Divi 4: it fades in after 2 seconds and closes with the X. I also added a version built with Divi 5 modules and Interactions, with no JavaScript.

What is a bubble popup link?

A bubble popup link is a small round image link fixed in a corner of the screen. It appears a moment after the page loads, follows the visitor on every page, and can be closed with a small X.

There are certain situations when you want to display some information relevant to all your website visitors, no matter the page they are currently viewing. In many cases, that would be a time-sensitive offer or a Call to Action. A popular approach is to use the top "promo bar", and the full-page popup is another option to consider. Here, on the Divi Lover website, I like to use a fixed round image displayed in the corner of the screen (I call it the bubble popup), and we use it every time we are having a sale or a new product launch.

Watch the video below to see how to create it in Divi step by step.

The video was recorded in Divi 4. The code is the same in Divi 5, and Divi → Theme Options → Integration, where you paste it, works the same way.

Want to see it in action? Here's the live preview.

How to add a bubble popup link to Divi with code

You need three pieces: the HTML structure in Divi → Theme Options → Integration (body code), the CSS that places and styles the bubble, and a few lines of jQuery that fade it in and close it. Because the code lives in Theme Options, the bubble shows on every page of your website, with no plugins.

Step 1: Add the HTML structure

Navigate to the Divi Theme Options Integration tab, turn on "Enable body code" and paste the code below into "Add code to the < body >". Change /landing-page to the page you want to link to, and the image URL to your own image:

<div class="dl-info-popup">
	<div class="bg"></div>
	<a href="/landing-page">
		<img src="https://demos.divilover.com/wp-content/uploads/2021/07/click_here.png" alt="Super Offer"/>
	</a>
	<span class="close"></span>
</div>

Step 2: Style it with CSS

This is the CSS code I've used, feel free to modify it to fit your design. Add it to Divi → Theme Options → General → Custom CSS (or your child theme stylesheet):

.dl-info-popup {
	position: fixed;
	bottom: 20px;
	left: 20px;
	width: 150px;
	height: 150px;
	display: none;
}

.dl-info-popup a {
	background: #19191a;
	display: block;
	border-radius: 50%;
	padding: 10%;
	position: relative;
	z-index: 2;
	width: 100%;
	height: 100%;
}

.dl-info-popup span.close {
	position: absolute;
	top: 5px;
	right: 0;
	width: 30px;
	height: 30px;
	background: #fff;
	border-radius: 15px;
	box-shadow: 1px 3px 15px rgba(0,0,0,0.2);
	cursor: pointer;
	z-index: 3;
}

.dl-info-popup span.close:before {
	display: block;
	position: absolute;
	top: 0;
	right: 0;
	bottom: 0;
	left: 0;
	color: #19191a;
	font-size: 24px;
	font-family: 'ETmodules';
	content: '\4d';
	line-height: 30px;
	text-align: center;
}

.dl-info-popup .bg {
	display: block;
	width: 100%;
	height: 100%;
	position: absolute;
	background: #FDFA00;
	background-image: linear-gradient(-15deg, #FDFA00, #FF19CF);
	border-radius: 50%;
	z-index: 1;
	filter: blur(30px);
	animation:opacity 3s ease-in-out infinite;
}

@keyframes opacity {
	0% {opacity:0;}
	50% {opacity:1;}
	100% {opacity:0;}
}

Step 3: Make it work with jQuery

This JavaScript code can be added in the Integration tab, just next to the HTML structure. It shows the bubble 2 seconds after the page loads (delay(2000), in milliseconds) and fades it out when someone clicks the X:

<script>
jQuery(document).ready(function($){
	
	$('.dl-info-popup').delay(2000).fadeIn();
	$('.dl-info-popup .close').click(function(e){
		e.preventDefault();
		$(this).parent().fadeOut();
	});
	
});		
</script>

In Divi 5, jQuery is loaded in the footer by default. The code above still works, because it is wrapped in jQuery(document).ready(): Divi runs it once jQuery has loaded.

Step 4 (optional): Hide it on a specific page

If you'd like to hide the "bubble" on a specific page of your website, you'd need to inspect that page to see what CSS class is added to the BODY element. Each page in WordPress has a unique ID, and this ID is attached to the body tag as a class, e.g. page-id-123. Once you know your page body class, you can target and hide the bubble popup element with this bit of CSS code:

body.page-id-123 .dl-info-popup {
	display: none!important;
}

How to build the bubble popup with Divi 5 Interactions (no code)

In Divi 5 you can also build the bubble from modules: a Group set to Position Fixed holds your image and a close icon, and Interactions show it after 2 seconds and hide it when the X is clicked. Only the glowing gradient behind the image still needs the CSS from Step 2.

  1. Add a Group module where the bubble should appear. To show it on every page, add it to your Global Footer in the Theme Builder.
  2. In the Group settings, go to Advanced → Position: set Position to Fixed, place it in the bottom left corner with a 20px offset, and give it a Z Index of 99. In Design → Sizing, set the Width to 150px.
  3. Inside the Group, add an Image module with your image, set the Image Link URL in Content → Link, and round its corners to 50% in Design → Border.
  4. Add an Icon module with an X icon, set its Position to Absolute in the top right corner (Advanced → Position) and make it smaller in the Design tab.
  5. On the Group, go to Advanced → Interactions → Add Interaction. First: Trigger Event Load, Effect Action Hide Element, Target Module: the Group itself. Second: Trigger Event Load, Effect Action Show Element, Target Module: the Group, Time Delay 2000ms.
  6. On the Icon, add one interaction: Trigger Event Click, Effect Action Hide Element, Target Module: Parent Container (the Group).

I tested this on a Divi 5 page: the bubble appeared after 2 seconds, stayed fixed in the corner and disappeared when I clicked the X. The difference from the jQuery version is that Hide Element removes the bubble at once, without the fade-out.

Final thoughts

I hope you like this approach and this walkthrough. If you build your own bubble popup, I'd love to see it: share it in my Divi Lovers Facebook group.

This article has been tagged with: Divi CSS, JavaScript & PHP, Popups & Interactions

Tags

Fixed bubble popup link in the corner of a Divi website

Table of Contents

Popular questions

Do I need a popup plugin for a bubble popup in Divi?

No. A few lines of HTML in Theme Options → Integration, some CSS and a short jQuery snippet are enough, and in Divi 5 you can even build it with a Group module and Interactions.

How do I change when the bubble popup appears?

Change the number in delay(2000). It's in milliseconds, so 5000 shows the bubble after 5 seconds. With the Divi 5 Interactions version, change the Time Delay of the Show Element interaction.

Does the bubble popup code work in Divi 5?

Yes. I tested it in Divi 5.18. Divi 5 loads jQuery in the footer, but the snippet is wrapped in jQuery(document).ready(), so it runs once jQuery has loaded, and the Integration tab in Theme Options works the same as in Divi 4.

How do I hide the bubble popup on one page?

Find the page's body class (for example page-id-123) with your browser's Inspect tool and add body.page-id-123 .dl-info-popup { display: none!important; } to your Custom CSS.

About the Author

Ania Romańska

I'm a Divi expert from Poland, with over 10 years building the templates and courses that make up Divi Lover. I'm also a mom of five, which taught me a thing or two about explaining things clearly the first time.

Hey there!Sorry to interrupt,but this one's important!

Divi Lover is turning 10!
Let’s celebrate with 40% off everything.

Ten years of Divi templates, plugins and tips, and a brand-new website to celebrate it. To say thank you, every product in the shop is 40% off until Cyber Monday.

Your code

Paste it at checkout. Valid until November 30.