When youβre building a custom header for your website, using Diviβs theme builder, youβll find yourself looking for the ideal way to add a CTA. One way you can go about it is by adding a dropdown contact form. This will help you keep the overall look and feel of your header clean while still providing the possibility to get in touch without the need for scrolling. In this tutorial, weβll show you how to create a dropdown contact form using Divi and some JQuery & CSS code. Youβll be able to download the JSON file for free as well!
Letβs get to it.
- 1 Preview
- 2 Download The Global Header Template for FREE
- 3 Download For Free
- 4 You have successfully subscribed. Please check your email address to confirm your subscription and get access to free weekly Divi layout packs!
- 5 1. Go to Divi Theme Builder & Start Building Global Header
- 6 2. Build Header Design
- 7 3. Customize Elements to Create Contact Form on Click
- 8 Preview
- 9 Final Thoughts
Preview
Before we dive into the tutorial, letβs take a quick look at the outcome across different screen sizes.
Desktop
Mobile
Download The Global Header Template for FREE
To lay your hands on the free global header 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 newsletter 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.
1. Go to Divi Theme Builder & Start Building Global Header
Go to Divi Theme Builder
Start by going to the Divi Theme Builder in the backend of your WordPress website.
Build Global Header
Click on βAdd Global Headerβ and select βBuild Global Headerβ to start building a custom global header.
2. Build Header Design
Section Settings
Background Color
Once inside the global header template, youβll notice a section. Open that section and use a white background color.
- Background Color: #FFFFFF
Spacing
Remove the sectionβs default top and bottom padding next.
- Top Padding: 0px
- Bottom Padding: 0px
Box Shadow
Apply a subtle box shadow too.
- Box Shadow Blur Strength: 50px
- Shadow Color: rgba(0,0,0,0.15)
Add New Row
Column Structure
Continue by adding a new row to the section using the following column structure:
Sizing
Without adding any modules yet, open the row settings and change the sizing settings as follows:
- Use Custom Gutter Width: Yes
- Gutter Width: 1
- Equalize Column Heights: Yes
- Width: 95%
- Max Width: 100%
Spacing
Add some custom top and bottom padding next.
- Top Padding: 1vw
- Bottom Padding: 1vw
Main Element
And align all column content by adding one single line of CSS code to the rowβs main element.
align-items: center;
Column 2 Z Index
Weβre also making sure the second column has a higher z index value for responsive purposes.
- Z Index: 12
Add Image Module to Column 1
Upload Logo
Time to start adding modules! Starting with an Image Module in column 1. Upload a logo.
Alignment
Change the moduleβs alignment next.
- Image Alignment: Center
Sizing
Modify the width too.
- Width: 3vw (Desktop), 5vw (Tablet), 7vw (Phone)
Select Menu
In the second column, weβll add a Menu Module.
Layout
Move on to the moduleβs design tab and change the layout style.
- Style: Centered
Menu Text Settings
Modify the moduleβs menu text settings next.
- Menu Font: Open Sans
- Menu Font Weight: Semi Bold
- Menu Text Color: #000000
- Menu Text Size: 0.8vw (Desktop), 2vw (Tablet), 3vw (Phone)
- Menu Letter Spacing: 1px
Dropdown Menu Text Settings
Then, change the dropdown menu line color.
- Dropdown Menu Line Color: #007dff
Icons
Along with the hamburger menu icon color.
- Hamburger Menu Icon Color: #007dff
Add Text Module 1 to Column 3
Add Copy
On to the third module! Add a Text Module with some copy of your choice.
Background Color
Add a background color next.
- Background Color: #007dff
Text Settings
Move on to the moduleβs design tab and change the text settings accordingly:
- Text Font: Open Sans
- Text Font Weight: Bold
- Text Color: #ffffff
- Text Size: 0.8vw (Desktop), 2vw (Tablet), 3vw (Phone)
- Text Alignment: Center
Sizing
Modify the moduleβs sizing settings next.
- Width: 33%
- Module Alignment: Center
Spacing
Then, add some custom top and bottom padding.
- Top Padding: 0.8vw (Desktop), 2vw (Tablet & Phone)
- Bottom Padding: 0.8vw (Desktop), 2vw (Tablet & Phone)
Border
And complete the moduleβs settings by adding some border radius.
- All Corners: 100px
Add Text Module 2 to Column 3
Add Symbol to Content Box
On to the next module, which is another Text Module. Add the following arrow symbol to the content box: ββΌβ.
Text Settings
Move on to the moduleβs design tab and change the text settings accordingly:
- Text Font: Open Sans
- Text Color: #007fff
- Text Size: 3vw
- Text Line Height: 0em
- Text Alignment: Center
Z Index
Weβre increasing the moduleβs z index too.
- Z Index: 11
Add Contact Form Module to Column 3
Add Fullwidth Fields of Choice
The next and last module we need in the third column is a Contact Form Module. Add all the fullwidth fields you need.
Add Title
Use a title too.
Background Color
Weβre changing the background color next.
- Background Color: #e7f2ff
Fields Settings
Then, move on to the moduleβs design tab and change the fields settings.
- Fields Background Color: #ffffff
- Fields Text Color: #dddddd
- Fields Focus Text Color: #007dff
- Fields Top Padding: 1vw (Desktop), 2vw (Tablet), 3vw (Phone)
- Fields Bottom Padding: 1vw (Desktop), 2vw (Tablet), 3vw (Phone)
- Fields Font: Open Sans
- Fields Text Size: 0.7vw (Desktop), 1.8vw (Tablet), 3vw (Phone)
Title Text Settings
Modify the title text settings next.
- Title Heading Level: H3
- Title Font Weight: Bold
- Title Text Alignment: Center
- Title Text Color: #007dff
- Title Text Size: 1vw (Desktop), 2.5vw (Tablet), 3.5vw (Phone)
- Title Line Height: 1.6em
Captcha Text Settings
Along with the captcha text settings.
- Captcha Font: Open Sans
- Captcha Text Color: #007dff
Button Settings
Continue by styling the button.
- Use Custom Styles For Button: Yes
- Button Text Size: 0.8vw (Desktop), 2vw (Tablet), 3vw (Phone)
- Button Text Color: #ffffff
- Button Background Color: #007dff
- Button Border Width: 0px
- Button Border Radius: 100px
- Button Font: Open Sans
- Button Font Weight: Bold
- Button Top Margin: 1vw
- Button Top Padding: 1vw (Desktop), 2vw (Tablet & Phone)
- Button Bottom Padding: 1vw (Desktop), 2vw (Tablet & Phone)
- Button Left Padding: 2vw (Desktop), 7vw (Tablet & Phone)
- Button Right Padding: 2vw (Desktop), 7vw (Tablet & Phone)
Spacing
Then, use some custom padding values across different screen sizes.
- Top Padding: 4vw (Desktop), 6vw (Tablet & Phone)
- Bottom Padding: 4vw (Desktop), 6vw (Tablet & Phone)
- Left Padding: 2vw (Desktop), 6vw (Tablet & Phone)
- Right Padding: 2vw (Desktop), 6vw (Tablet & Phone)
Border
Modify the border settings next.
- All Corners: 10px
Main Element, Contact Title & Captcha CSS
Complete the moduleβs settings by adding some small CSS changes to the advanced tab.
Main Element:
border-radius: 20px;
Contact Title:
margin-bottom: 1vw;
Captcha:
margin-top: 1.5vw;
3. Customize Elements to Create Contact Form on Click
Add Column 3 Height
Once you have all modules in place, itβs time to create the effect. The first step towards achieving the desired outcome is opening the column 3 settings and adding some responsive custom height in the advanced tab.
Desktop:
height: 3vw;
Tablet:
height: 5vw;
Phone:
height: 6vw;
Then, weβll add the same CSS class to both first Text Modules in column 3.
- CSS Class: show-contact
Add CSS Class to Contact Form
Weβll need a custom CSS class for the Contact Form Module too.
- CSS Class: contact-form-module
Hide Contact Form Module
Continue by adding one extra line of CSS code to the Contact Form Moduleβs main element. This will allow us to hide the module before click.
display: none;
Add Code Module to Column 3 with JQuery & CSS Code
And to create the click function, weβll need some JQuery code. Weβll use some custom CSS code too. Add a new Code Module to column 2 with the code. Make sure you place the JQuery code between script tags and the CSS code between style tags.
jQuery(function($){ $(".show-contact").click(function() { $('.contact-form-module').slideToggle(); }); });
.show-contact { cursor: pointer; } .et-menu>li { padding-left: 0.7vw !important; padding-right: 0.7vw !important; }
Preview
Now that weβve gone through all the steps, letβs take a final look at the outcome across different screen sizes.
Desktop
Mobile
Final Thoughts
In this post, weβve shown you how to add a dropdown contact form to your custom-built header. This is a great way to trigger action right from the beginning. Weβve also shared the JSON file for free! 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.
Excuse the begginer
I have downloaded the zip file
I’ve got the .json file extracted
trying to import it to DIVI Library and got the message
This file should not be imported in this context.
Have you any Idea what I’m doing wrong ?
Thanks !!
P.s. Stay at Home
You should import it to the Divi Theme Builder instead of the Divi Library.
I can’t seem to get this JSON file to import no matter where I try it. Am I doing something wrong?
Nevermind, got it to work finally. Just needed to leave the checkboxes alone during import.
The only problem….how do I enable the SUBMIT button to send email to my website address?
When I press SUBMIT nothing happens
Thank you
Is anyone else having an issue with the form staying open? I have everything else working, but it closes as soon as I click in a field.
Actually mine starts as open and then when I click it, it closes!
The same happened with me , but , the solution is simple. Use JSON file instead.
Thanks for this amazing techniques i will try this. Great work thanks for this information.
Good tutorial
The json file does not work
Great and easy to set up. Congratulations and thank you for this resource.
Hi,
It looks great AND very practical! I am just about starting a site where I could really use it… I am at the right time at the right place to have seen this article! π
json file please
excellent header
i tried to do this in a test page before making it to all the site but when i finished the “theme” it never applied to the page i was testing on. Any ideas why this happen?