How to Add a Fixed Map Toggle to Your Divi Page Template | Elegant Themes Blog

If you’re running a physical store and creating a website for it, many people may visit your website to get practical information, such as your address. Of course, that’s where your contact page comes in handy, but that’s not the only way you can seamlessly share contact details with your visitors. If you’re looking for a creative way to approach sharing your company’s address, you’ll like this tutorial. We’re showing you how to add a fixed map toggle dynamically to each page using Divi’s Theme Builder. We’ll start by creating a new page template. Then, we’ll include the dynamic page content in side the template’s body and we’ll add a fixed map toggle on top of the dynamic page content. You’ll be able to download the template JSON file for free as well!

Let’s get to it.

Download The Page Template for FREE

To lay your hands on the free page template, you will first need to download it using the button below. To gain access to the download you will need to subscribe to our Divi Daily email list by using the form below. As a new subscriber, you will receive even more Divi goodness and a free Divi Layout pack every Monday! If you’re already on the list, simply enter your email address below and click download. You will not be “resubscribed” or receive extra emails.

Join the Divi Newsletter and we will email you a copy of the ultimate Divi Landing Page Layout Pack, plus tons of other amazing and free Divi resources, tips and tricks. Follow along and you will be a Divi master in no time. If you are already subscribed simply type in your email address below and click download to access the layout pack.

You have successfully subscribed. Please check your email address to confirm your subscription and get access to free weekly Divi layout packs!

1. Create Page Template Inside Divi Theme Builder

Go to the Divi Theme Builder & Add a New Page Template

We’ll start this tutorial by navigating to the Divi Theme Builder and adding a new page template.

Enter Body Area of Template

Then, enter the template’s body by selecting “Build Custom Body”.

2. Add Dynamic Page Content to Body Area

Once inside the template editor, you’ll notice a section. Open the section settings and remove all default top and bottom padding.

Continue by adding a new row using the following column structure:

Remove all default top and bottom padding next.

Add Post Content Module to Column

To allow each page’s content to show up dynamically, we’ll use the Post Content Module inside this row.

3. Create Fixed Map Pin Design

Add Row #2 to Section

On to the next row, which uses the following column structure:

Remove all default top and bottom padding next.

Then, open the column 1 settings and use a black background color.

Background Image

Upload a background image of your choice next. You can find the background image in the zipped folder which you can download at the beginning of this tutorial.

Main Element CSS

Add the following lines of CSS code to the column’s main element as well:

Then, put the vertical overflow to auto. This, in combination with the max height in the previous step, makes sure a scrollbar appears as soon as the column exceeds an 80vh height.

Column 2 Settings

Open the column 2 settings next and apply the following line of CSS code to the main element:

Add Map Module to Column 1

Time to add modules, starting with a Map Module in column 1. Add a map pin of your choice.

Remove the default bottom margin next.

Add Blurb Module to Column 1

Add Content

Add a Blurb Module below the Map Module in column 1. Use some content of your choice.

Select Icon

Image/Icon Settings

Move on to the design tab and change the icon settings as follows:

Title Text Settings

Style the title text next.

Body Text Settings

Then, modify the body text settings accordingly:

And remove the default module animation in the animation settings.

Add Blurb Module to Column 2

Leave Content Boxes Empty

On to column 2. There, we’ll add a Blurb Module without content.

Select Icon

Select an icon next.

Then, change the background color.

Image/Icon Settings

Move on to the design tab and style the icon settings accordingly:

Box Shadow

Include a box shadow as well.

Main Element & Blurb Image CSS

Then, navigate to the advanced tab and use the following lines of CSS code for the main element:

And add this line of CSS code inside the Blurb Image box:

4. Add Toggle Functionality

Add CSS Class to Row #2

Now that we have all elements in place, it’s time to focus on functionality. Start by opening the second row and applying the following CSS class:

Add CSS Class to Blurb Module in Column 2

Open the Blurb Module in column 2 next and use the following CSS class:

Add Code Module Below Blurb Module in Column 2

Then, add a Code Module below the Blurb Module in column 2.

Add Style & Script Tags

Place some style and script tags inside the code box.

Insert CSS Code

We’re using the following CSS code inside the style tags:

Insert JQuery Code

And the following JQuery code inside the script tags:

Add Fixed Position with Horizontal Offset to Row #2

Last but not least, we’ll need to modify the second row’s position settings accordingly:

5. Save Page & Theme Builder Changes

Once all changes have been applied, you can save all Divi Theme Builder changes and view the outcome on your website!

In this tutorial, we’ve shown you how to creatively include your business’ address details throughout your page designs. More specifically, we’ve shown you how to build a page template that includes a fixed map toggle, so your visitors can access your business’ location at all times! You were able to download the template JSON file for free as well. If you have any questions or suggestions, feel free to leave a comment in the comment section below.

If you’re eager to learn more about Divi and get more Divi freebies, make sure you subscribe to our email newsletter and YouTube channel so you’ll always be one of the first people to know and get benefits from this free content.

This content was originally published here.