Created
June 18, 2018 19:52
-
-
Save SJ-James/af9293f90260e3f470c23e13804478a9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function special_divi_header(){?> | |
<ul id="new-top-menu"> | |
<?php echo wp_nav_menu( array( 'theme_location' => 'secondary-menu' ) ); ?> | |
</ul> | |
<script> | |
jQuery(document).ready(function ($) { | |
$("<ul id='new-menu'></ul>").insertAfter("#et-top-navigation"); | |
$("#mobile_menu_slide .outside").clone().appendTo("#new-menu"); | |
$("#top-menu").insertBefore("#main-header .container"); | |
var $window = $(window), | |
$page = $('body'); | |
function resize() { | |
if ($window.width() < 980) { | |
return $page.addClass('hide-new-menu'); | |
} | |
$page.removeClass('hide-new-menu'); | |
} | |
$window | |
.resize(resize) | |
.trigger('resize'); | |
}); | |
</script> | |
<style> | |
#new-menu li { | |
display: inline-block; | |
margin-left: 20px; | |
font-weight: 600; | |
} | |
#new-menu { | |
display: inline; | |
float: right; | |
padding-top: 26px; | |
margin-right: 20px; | |
} | |
.logo_container { | |
z-index: -1; | |
} | |
.et-fixed-header #new-menu { | |
padding-top: 26px; /* adjust if header is different size after scroll */ | |
} | |
#new-menu li a { | |
color: #303030; | |
} | |
body #mobile_menu_slide .outside { | |
display: none; | |
} | |
body.hide-new-menu #mobile_menu_slide .outside { | |
display: block ; | |
} | |
body.hide-new-menu #new-menu { | |
display: none; | |
} | |
#top-header { | |
display: block !important; | |
} | |
body:not(.hide-new-menu) #new-top-menu { | |
display: block; | |
position: absolute; | |
top: -36px; | |
left: 0; | |
width: 100%; | |
height: 40px; | |
background: #303030; | |
padding: 6px 40px; | |
} | |
body:not(.hide-new-menu) #new-top-menu li { | |
float: right; | |
margin-left: 20px; | |
} | |
body:not(.hide-new-menu) #new-top-menu li a { | |
color: #fff; | |
} | |
body:not(.hide-new-menu) #main-header { | |
margin-top: 36px; | |
} | |
.hide-new-menu #new-top-menu { | |
display: none !important; | |
} | |
</style> | |
<?php | |
} | |
add_action( 'et_header_top', 'special_divi_header', 99 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment