11/22/17: Update! We just launched Divi Bars— the brand new plugin version of this tutorial with LOADS of features & templates! This tutorial and the promo bar generator will always remain free, however support is limited. We highly recommend checking out the all new Divi Bars plugin ????

Elegant Themes recently launched the groundbreaking Divi 3.0. To promote the launch, they created a gorgeous slide in promo bar that tastefully announces the arrival of Divi 3.0 to website visitors.

 

After seeing quite a few people ask how to recreate the promo slide in bar in Divi, I decided to create a tutorial. And to make things even easier, I built a little generator to help you customize the promo bar! ????

 

Perhaps you haven’t heard of a “promo bar” before. There’s lots of names, for essentially the same thing. For example, a “notification bar”, “hello bar”, or “floating header bar” are all names I’ve seen to describe the same thing.

If you haven’t seen the promo bar over at ElegantThemes.com, here’s a screenshot below, or you can of course go take a look for yourself.

 

Also, you can see a demo of the what we’ll be creating by clicking the button below. ????

Okay so let’s get started creating the promo bar. The hard work has already been done for you, so it’ll be a snap. The code below is pretty messy, but stay tuned and I’ll show you how to use the generator to make customizing the promo bar a snap.

The Divi Slide In Promo Bar Code

Divi Slide In Promo Bar Code
<div></div><script>function elegantPromo(a){function l(a,b){return"undefined"==typeof a?b:a}function m(a){var b=24*a*60*60*1e3,c=new Date;return c.setTime(c.getTime()+b),"; expires="+c.toGMTString()+"; path=/"}function n(a,d,e){document.cookie=a+"=; expires=-1; path=/","false"===e?document.cookie=a+"="+d+"; path=/":"long"===e?document.cookie=a+"="+d+c:document.cookie=a+"="+d+b}function o(){jQuery("head").append(e),jQuery("body").prepend(d),jQuery(".promo-slide-in-button").on("click",function(){p()}),jQuery(".promo-slide-in-close-promo").on("click",function(){p(),jQuery(".promo-slide-in").addClass("promo-slide-in-closed").delay(1e3).queue(function(a){jQuery(this).hide(),a()})})}function p(){new_value="closed",n(i,new_value,"true")}function r(){var a=document.cookie.split("; ").reduce(function(a,b){var c=b.split("=");return a[c[0]]=c[1],a},{});return a}function s(a){var b="; "+document.cookie,c=b.split("; "+a+"=");if(2==c.length)return c.pop().split(";").shift()}var a=a||{},b=m(a.cookieExpire)||"",c=m(a.longExpire)||"",d=l(a.promohtml,""),e=l(a.promocss,""),h=(l(a.promopage,""),document.getElementsByTagName("html")[0],r()),i="Elegant_Themes_Promo_State",k=(h[i],s("Elegant_Themes_Promo_State"));if(!k){base_value="open",document.cookie=i+"="+base_value+b;var k=s("Elegant_Themes_Promo_State")}"open"===k&&o()}var _elegantPromo=elegantPromo({cookieExpire:7,longExpire:365,promopage:"gallery",promocss:'<style id="et-promo-slide-in">.promo-slide-in{position: fixed; z-index: 9;height:60px;color:#ffffff;-webkit-transition:all .5 ease;transition:all .5 ease;top:0;left:0;right:0;background:#7e3bd0;overflow:hidden;width:100%;-webkit-animation:promo-slide-in 2s ease;animation:promo-slide-in 2s ease}.promo-slide-in-closed{-webkit-animation:promo-slide-out 1s ease;animation:promo-slide-out 1s ease}@-webkit-keyframes promo-slide-in{0%{background:#d03bc4;height:0}50%{height:60px}100%{background:#7e3bd0;height:60px}}@keyframes promo-slide-in{0%{background:#d03bc4;height:0}50%{height:60px}100%{background:#7e3bd0;height:60px}}@-webkit-keyframes promo-slide-out{0%{background:#7e3bd0;height:60px}100%{background:#d03bc4;height:0}}@keyframes promo-slide-out{0%{background:#7e3bd0;height:60px}100%{background:#d03bc4;height:0}}@-webkit-keyframes promo-fade-in{0%{-webkit-transform:scale(.5);transform:scale(.5);opacity:0}100%{-webkit-transform:scale(1);transform:scale(1);opacity:1}}@keyframes promo-fade-in{0%{-webkit-transform:scale(.5);transform:scale(.5);opacity:0}100%{-webkit-transform:scale(1);transform:scale(1);opacity:1}}.promo-slide-in-close-promo{position:absolute;right:20px;top:16px;width:32px;height:32px;clear:both;cursor:pointer;-webkit-animation:promo-fade-in 1s ease;animation:promo-fade-in 1s ease}.promo-slide-in-close-promo:after,.promo-slide-in-close-promo:before{position:absolute;content:"";height:24px;width:3px;border-radius:4px;background-color:#fff;right:14px;}.promo-slide-in-close-promo:before{-webkit-transform:rotate(45deg);transform:rotate(45deg)}.promo-slide-in-close-promo:after{-webkit-transform:rotate(-45deg);transform:rotate(-45deg)}.promo-slide-in-button{background:#ffffff;border-radius:30px;text-transform:uppercase;color:#7e3bd0;text-decoration:none!important;padding:7px 20px;display:inline-block;font-size:14px;font-weight:700;float:left;margin:12px 0 0 20px;-webkit-transition:all .5s ease;transition:all .5s ease}.promo-slide-in-button:hover{color:#ffffff;background:#d03bc4;}.promo-slide-in-content{width:960px;margin:0 auto;text-align:center;-webkit-animation:promo-fade-in 1s ease;animation:promo-fade-in 1s ease;position:relative}.promo-slide-in-content-inner{margin:0 auto}.promo-slide-in-content p{margin:17px 0 0 127px;padding:0;display:inline-block;float:left;font-size:24px;color:#ffffff;}.fixed-nav-page-container{padding-top:130px !important;}.fixed-nav-main-header{top:60px !important;}.nonfixed-nav-main-header{padding-top:60px;}@media (max-width: 980px) { .promo-slide-in-content p { font-size: 20px; }.promo-slide-in-button { padding: 5px 17px; font-size: 12px; } }@media (max-width: 775px) {.promo-slide-in-content { width: 100%;} .promo-slide-in-content p { margin: 0; font-size: 15px; width: 60%; line-height: 1.3em; position: absolute; left: 5%; padding-top: 3%; } .promo-slide-in-button { padding: 4px 12px; font-size: 10px; margin: 14px 0 0 0px; position: absolute; right: 60px; } }@media (min-width: 665px) and (max-width: 775px) { .promo-slide-in-content p { font-size: 18px; } .promo-slide-in-button { font-size: 12px; } }</style>',promohtml:'<div class="promo-slide-in"><div class="promo-slide-in-content"><div class="promo-slide-in-content-inner"><p>I made this cool promo slide in over at Divi Life!</p> <a class="promo-slide-in-button"href="https://divilife.com">Learn More</a></div></div><div class="promo-slide-in-close-promo"></div></div>'});</script><script type="text/javascript">if (jQuery( "body" ).find( "div.promo-slide-in" ).length > 0){if(jQuery("body").hasClass("et_non_fixed_nav")){jQuery(".et_non_fixed_nav #main-header").addClass("nonfixed-nav-main-header");}if(jQuery("body").hasClass("et_fixed_nav")){jQuery(".et_fixed_nav.et_show_nav #page-container").addClass("fixed-nav-page-container");jQuery(".et_fixed_nav #main-header").addClass("fixed-nav-main-header");}}jQuery(".promo-slide-in .promo-slide-in-close-promo").click(function(){jQuery(this).parent().hide();if(jQuery("body").hasClass("et_fixed_nav")){jQuery(".et_fixed_nav.et_show_nav #page-container").removeClass("fixed-nav-page-container");jQuery(".et_fixed_nav #main-header").removeClass("fixed-nav-main-header");}if(jQuery("body").hasClass("et_non_fixed_nav")){jQuery(".et_non_fixed_nav #main-header").removeClass("nonfixed-nav-main-header");}});</script>  

Okay so you can customize the code above, and move on to the last step, however I’d recommend utilizing the generator I created below for an extremely easy way to customize the promo bar for your own use. ????

The Promo Bar Code Generator

To use the generator, simply fill in the form fields below and hit the submit button. The generator will then email you the code to copy and paste into your website. I’ll show you where to put the code in the next step.   Disclaimer: By using the generator, you will be subscribed to the Divi Life email list, however you can unsubscribe at anytime. And, don’t you want to be the first to know when new freebies like this are added anyways?? ????

 

Tip: For finding the correct hexadecimal colors (ie. #ffffff) to use in the generator below, you can use a website like this: http://html-color-codes.info/

The Generator:

 

  • This is where we’ll send you the code to use on your own site!

Placing the Promo Bar Code on Your Divi Website

Okay, so this next step will show you how to actually add the slide-in promo bar code to your Divi website. The step is the same whether you’re using the code from the code box above and customizing it manually, or using the handy generator I created.

 

We actually have two options for adding the code to your website. They’re both extremely simple. Before you choose which method though, you’ll need to decide whether you want the code displayed on just one page, or all the pages on your site. Once you’ve decided, follow the relevant method below. You don’t need to do both methods.

 

Adding the Promo Bar Code to Just One Page

If you’d like to add the promo bar to all the pages on your site then skip this step, and move onto the next step. Okay the first thing we need to do is make sure you have the code copied to your clipboard. Be sure that you have the code in it’s entirety copied, nothing is there by mistake ????

 

Next, go to the page you’d like to add the promo bar to, and create a new code module. It doesn’t matter where on the page you add the module, because the CSS code will automatically position it into place.

 

Now, paste the code into the code module and save it. Be sure to save the module itself, as well as saving the page. Now you’re done. Go and take a look and admire what you just created ????

 

Adding the Promo Bar to All Pages of Your Website

Adding the Promo Bar to every page of your Divi website is very easy, and can be done with one step. Firstly, copy the promo bar code to your clipboard. Make sure you copy it in it’s entirety, because nothing is there by mistake ????

 

Now, from the WP Admin section of your website, go to Divi > Divi Theme Options > Integration tab, and locate the box for: Add code to the < body > (good for tracking codes such as google analytics)

body-section-integration-tab-divi

 

Paste the code into the box and hit save. Make sure the switch for “Enable Body Code” is on (lit up with blue). It’s on by default, but if you find it off, hit the switch and make sure you hit save again.

 

And we’re done! Now admire your creation ???? If you have any questions, please feel free to comment below.