Reveal a Divi Element when a Blurb Module is Clicked

Written by Dan Mossop

I've previously written about revealing content at the click of a Divi button. Here's how to do a similar thing using the Divi Blurb module – that is, revealing a Divi module, row or section when the Blurb module is clicked.

Add Classes to your Blurb module

First, add the following classes to your Blurb module:

rv_blurb rv_blurb_1 rv_blurb_closed

You can add them at:

Blurb Settings > Advanced > CSS ID & Classes > CSS Class 

Like so:

The "rv_blurb" is a general class that can be used to apply styles to all such clickable blurbs.

The "rv_blurb_1" class is specific to this blurb and will be used to associate this blurb with the element it is to reveal. If you add additional clickable blurbs, give them their own variants of this class, e.g. "rv_blurb_2", "rv_blurb_3" and so on. 

The "rv_blurb_closed" class won't be used here, but is added so that you can style the blurb differently depending on whether or not its associated content is shown or hidden. The class will be changed to "rv_blurb_opened" when the content is visible.

Add a Classes to your Content element

Now add the following classes to the element you want to show / hide (i.e. your module, row or section):

rv_element rv_element_1

You can add them at:

Module Settings > Advanced > CSS ID & Classes > CSS Class 

Like so:

Again "rv_element" is a general class that can be used to apply styles to all such elements.

The "rv_element_1" class is specific to the content element(s) to be hidden by your first blurb. If you add additional clickable blurbs, then give their respective content elements their own variants of this class, e.g. "rv_element_2", "rv_element_3" and so on. 

Add the CSS and JavaScript

Now add the following CSS and JavaScript code to your site. It will do the work of initially hiding the content element, handling the click on the blurb module and then revealing the content element:

<style>
body:not(.et-fb) .rv_element { 
	display: none; 
}
.rv_blurb {
	cursor: pointer;
}
</style>

<script>
jQuery(function($){
	var revealBlurbs = {
		'.rv_blurb_1': '.rv_element_1'
	};
	$.each(revealBlurbs, function(revealBlurb, revealElement) {
		$(revealBlurb).click(function(e){
			e.preventDefault();
			$(revealElement).slideToggle();
			$(revealBlurb).toggleClass('rv_blurb_opened rv_blurb_closed');
		});
	});
});
</script>

An easy way to add this is by pasting it all into a Divi Code module on the same page as your Blurb module. Alternatively, you can add it at:

Divi > Theme Options > Integrations > Add this code to the head of your blog

Save and View the Page

If you now save the page and view it on the front-end you should find that the content element is initially hidden. If you click on the blurb, the content element will be revealed, and if you click on the blurb again the content element will once again be hidden.

We may earn a commission when you visit links on our website.

Transform Your Pages with Divi Show / Hide Button!

Unleash the full potential of your Divi site with the Divi Show / Hide Button Module. Control the visibility of sections, rows, or modules with ease, create engaging tabs, and style your buttons just like any other Divi button. Perfect for keeping your pages clean and interactive.

Latest Posts

Set Custom CSS IDs for Individual Divi Accordion Items

Assigning unique CSS IDs to specific Divi Accordion items allows for precise control over styling, targeting, and linking within your page content. This ability is particularly useful when you want to apply custom designs or create anchor links to particular accordion...

Enable Swipe Navigation in the Divi Gallery Lightbox

Enabling swipe navigation in the Divi Gallery module's lightbox allows users to seamlessly browse through gallery images by swiping left or right, creating a more interactive and mobile-friendly experience. This functionality can significantly improve user engagement...

Disable Slide-In Animation for Divi Gallery Grid Images

Control how images appear in your Divi Gallery module by toggling the slide-in animation effect for grid layouts. Disabling the slide-in animation allows gallery images to load instantly and appear statically, providing a faster and distraction-free browsing...

Control Image Count Display in Divi Gallery Lightbox

Displaying or hiding the image count in the Divi Gallery module’s lightbox can help customize the user experience, depending on whether you want to give visitors an indication of gallery progress or prefer a cleaner, distraction-free view. The ability to toggle this...

Hide Gallery Image Titles in the Divi Lightbox Overlay

Displaying image titles in the lightbox overlay of the Divi Gallery module can sometimes be distracting or unnecessary, depending on your website’s design and user experience goals. Hiding these titles creates a cleaner and more focused viewing experience for visitors...

Random Posts

About Dan Mossop

Dan is a Scottish-born web developer, now living in Brisbane with his wife and son. He has been sharing tips and helping users with Divi since 2014. He created Divi Booster, the first Divi plugin, and continues to develop it along with 20+ other Divi plugins. Dan has a PhD in Computer Science, a background in web security and likes a lot of stuff, 

2 Comments

  1. Hey, I've just tried this and it's not revealing the text module, it's just concealing itself when clicked. I've tried a few different places of adding the code… same thing.

    What date was this tutorial published please?

    Reply
    • Hey Bec, sorry you're having trouble with this. The post was published in July and was updated in October, so I'd consider it current given the limited Divi updates in that time. Is there any chance you able to share a link to the page you're working on (privately, via the contact form, if you like)? It sounds like maybe something is overriding the CSS to hide the text module initially, but I should be able to tell you more if I can see it in action. Thanks!

      Reply

Submit a Comment

Comments are manually moderated and approved at the time they are answered. A preview is shown while pending but may disappear if your are cookies cleared - don't worry though, the comment is still in the queue.

Your email address will not be published. Required fields are marked *.