Here is my website:
drawyourpets.com
I followed the tutorial here: http://www.internetkultur.at/simple-hamburger-drop-down-menu-with-css-and-jquery/, but unfortunately my hamburger menu is always visible (it’s only supposed to be visisble from 0-780px) and it doesn’t work.
I copied and pasted the code from the HTML section into header.php. The code from the tutorial starts with div class=”mobile nav” and ends with it’s respective div. I also added
<script src="javascript.js"></script>
to link header.php to the javascript code from the tutorial. Javascript.js was uploaded to the child theme.
<?php
/** * Header template * * @package Portfolio Press */?>
<!DOCTYPE html>
<html <?php language_attributes(); ?>>
<head>
<meta charset="<?php bloginfo( 'charset' ); ?>">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="profile" href="http://gmpg.org/xfn/11">
<link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>">
<script src="javascript.js"></script>
<!--[if lt IE 9]>
<script src="<?php echo esc_url( get_template_directory_uri() .
'/js/html5.js' ); ?>">
</script><![endif]-->
<?php wp_head(); ?></head><body <?php body_class(); ?>><div id="page">
<header id="branding">
<div class="col-width">
<?php $heading_tag = ( is_home() || is_front_page() ) ? 'h1' : 'div'; ?
>
<div class="logo">
<a href="<?php echo esc_url( home_url( '/' ) );
?>
"rel="home">
<img src="<?php echo esc_url( portfoliopress_get_option( 'logo' ) ); ?
>" alt="<?php echo bloginfo( 'name' ) ?>">
</a>
</div>
<div class="site-description">
<h1 id="pets">DRAW YOUR PETS</h1>
<h3 id="italic">-The Creative Side-
</h2>
</div>
<div class="clear clearfix">
</div>
<div class="site-navigation primary-navigation" role="navigation">
<div class="mobile-nav">
<div class="menu-btn" id="menu-btn">
<div></div>
<span></span>
<span></span>
<span></span>
</div>
<div class="responsive-menu">
<ul>
<li><a href="http://drawyourpets.com/">
HOME</a>
</li>
<li>
<a href="http://drawyourpets.
com/index.php/audio/">
AUDIO
</a>
</li>
<li><a href="http://drawyourpets.com/index.php/video-3/">
VIDEO
</a>
</li>
<li>
<a href="http://
drawyourpets.com/index.php/other/">
OTHER</a>
</li>
</ul>
</div>
</div>
<?php wp_nav_menu( array( 'theme_location' => 'primary', 'menu_class'|
=> 'nav-menu' ) ); ?>
</div>
<div id="main">
<div class="site-wrapper">
Besides that, I just added the CSS from the tutorial into my child theme stylesheet with this media query above it:
@media screen and (min-width: 780px) .menu-btn div {
So I’m not sure what I’ve done wrong or what I need to do to fix it. Let me know if you have any ideas. Thanks!
Firstly, the path is wrong; 404;
bloginfo(‘template_url’); This is your path of theme, you can upload the javascript.js to the corresponding path
Secondly, the “javascript.js” need “jquery.js”; So you must add this behind “jquery.js”
No, you just include a jQuery files. Add this :
above your javascript.js