You are on page 1of 3

header 1

demo: https://www.w3schools.com/howto/tryit.asp?filename=tryhow_js_overlay2
local:http://localhost/nav/

// header file
<style>
.overlay {
height: 0%;
width: 100%;
position: fixed;
z-index: 1;
top: 0;
left: 0;
background-color: rgb(0,0,0);
background-color: rgba(0,0,0, 0.9);
overflow-y: hidden;
transition: 0.5s;
}

.overlay-content {
position: relative;
top: 25%;
width: 100%;
text-align: center;
margin-top: 30px;
}

.overlay a {
padding: 8px;
text-decoration: none;
font-size: 36px;
color: #818181;
display: block;
transition: 0.3s;
}

.overlay a:hover, .overlay a:focus {


color: #f1f1f1;
}

.overlay .closebtn {
position: absolute;
top: 20px;
right: 45px;
font-size: 60px;
}

@media screen and (max-height: 450px) {


.overlay {overflow-y: auto;}
.overlay a {font-size: 20px}
.overlay .closebtn {
font-size: 40px;
top: 15px;
right: 35px;
}
}
</style>

<script>
function openNav() {
document.getElementById("myNav").style.height = "100%";
}

function closeNav() {
document.getElementById("myNav").style.height = "0%";
}
</script>

<div id="myNav" class="overlay">


<a href="javascript:void(0)" class="closebtn" onClick="closeNav()">&times;</a>
<div class="overlay-content">
<?php wp_nav_menu(array('theme_location' => 'menu-1', 'menu_id' => '', 'class'
=>'')); ?>
</div>
</div>
<span style="font-size:30px;cursor:pointer" onClick="openNav()">&#9776; </span>

// function file

wp_enqueue_script('jquery');

===================================================

header 2
demo: http://school-theme-demo.crazycafe.net/
local:http://localhost/nav/

// header file

<nav id="site-navigation" class="main-navigation" role="navigation">


<?php wp_nav_menu(array('theme_location' => 'menu-1', 'menu_id' => 'nav',
'class' =>'primary-menu')); ?>
</nav><!-- #site-navigation -->

// function file

wp_enqueue_style( 'rrf-education-theme-slicknav', get_template_directory_uri() .


'/css/slicknav.min.css', array(), '1.0' );
wp_enqueue_script('jquery');
wp_enqueue_script( 'rrf-education-theme-slicknav-js',
get_template_directory_uri() . '/js/jquery.slicknav.min.js', array(), '20120206',
true );

css file

@media only screen and (max-width: 767px){


.slicknav_menu {
background: #024691 none repeat scroll 0 0 !important;
font-size: 15px;
padding: 0 5px;
display: block !important;
}

.slicknav_menu {
display: none;
}

You might also like