The new Elegant Themes menu has been a popular request for developers to duplicate on their own sites. The main feature of the menu is the call to action (CTA) button that grabs the attention of visitors by changing colors and animating when scrolling down the page. Having this kind of CTA button on your site will likely increase click rate and conversions.
Today I’m going to show you how to duplicate Elegant Theme’s primary menu using Divi. To implement the custom style and functionality of the button, I will be using a combination of CSS and jQuery.
From the WordPress Dashboard, go to Appearance → Menus. At the top of the menus page click Screen Options and check CSS Classes. This will allow you to add a custom CSS class to your menu items.
Now click “create new menu” and give your menu a name.
Next, add the menu links to your new menu. Since we are duplicating the Elegant Themes menu I’m adding the following custom links:
Once you are finished adding the links to your menu, select the new menu as the primary menu for your site.
In order to change the “Join to Download” menu link into the CTA button, you will need to add a custom CSS class to it so you can style it later using CSS. To add the class, click the arrow on the right of the Join to Download menu item to reveal the configuration options. Add a class called “jointoday_button” inside the CSS Classes text box.
With the menu created and set as the primary menu, it’s time to add the styling to the navigation menu and CTA button.
First we need to change your primary menu bar text size. Go to Theme Customizer → Header & Navigation → Primary Menu Bar. Keep all of the default settings and change the text size to 15.
The rest of the navigation menu will be styled using custom CSS. Under Theme Customizer, go to Additional CSS and add the following custom CSS (you can also add these to your child theme’s style.css file):
You are almost done. Let’s check out what the menu looks like so far.
Notice the shadow under the menu has been removed and only shows when the fixed navigation is activated when scrolling down the page. Also, the CTA button has been styled to change colors on fixed navigation.
All that is left to do is add the additional color change and pulse animation to the button when scrolling down to a certain point on the page. This additional functionality draws further attention to the CTA button as the user engages with content. In order to add this effect, we need to add an additional CSS class to the button only when the user scrolls to a specific point on the page. In this case, we will be adding the class “et_highlight_nav” to the menu when the user scrolls to a point greater than 50 percent of the body of the page. This class will be removed once the user scrolls back to the top of the page.
You can accomplish this by adding some jQuery. Go to Divi → Theme Options, and under the Integration tab, add the following jQuery to the “Add code to the head of your blog” text area:
The class “et_highlight_nav” can now be used to style the CTA button with a pulse animation and a blue color. Since you already added the custom CSS for this effect earlier, you are all set.
Check out the menu now.
The CTA button will now turn blue and pulse as you scroll further down the page and reset when you go back to the top of the page.
Since the CTA button is using a custom CSS class, you can change the button’s style to match your site by adjusting the CSS you added earlier. Simply replace the color code with your own. Here are the sections of CSS that target the different button styles:
If you change the color of your button, make sure to change the bottom border of your button on mobile by changing the CSS here:
The custom CSS added earlier will center your menu items and properly space your CTA button on mobile just like on the elegant themes mobile menu.
For this tutorial, I’m using the default font Open Sans as the menu font. The default font for the Elegant Themes site (including the menu text) is a font called Poppins. You can import this font using Google Fonts by following the instructions on this previous post.
That’s it! You have successfully duplicated the Elegant Themes primary menu. And, you can adjust the style of your CTA button to match the design of your site by adjusting the custom CSS. Since the button colors change on the fixed navigation and animate when scrolling down the page, users are more likely to notice the CTA which will help your conversions.
I hope this new menu will be a useful feature for upcoming projects. And I look forward to hearing from you in the comments below.