I am having issues with getting jQuery to work on my theme I am developing. None of the functions are working
Here is my enqueue'd scripts;
function spk_theme_js() {
wp_enqueue_script('modernizer_js', get_template_directory_uri() . '/js/modernizr-2.6.2.min.js', '','', false);
wp_enqueue_script( 'mainscript_js', get_template_directory_uri() . '/js/main.js', '', array ( 'jQuery' ), true);
}
add_action('wp_enqueue_scripts', 'spk_theme_js');
Here is my main.js code;
jQuery(document).ready(function($) {
/**************
Navigation Bar
***************/
'use strict';
$('.fa-bars').click(function () {
$("#myNav").css('height', '100%');
});
$('.closebtn').click(function () {
$("#myNav").css('height', '0%');
});
});
When I click on the selected elements, nothing happens. Please assist.
I have updated the code and added the HTML.
<nav>
<img src="img/SpakaDigital.png" id="logo">
<!-- The overlay -->
<div id="myNav" class="overlay">
<!-- Button to close the overlay navigation -->
<a href="javascript:void(0)" class="closebtn">×</a>
<!-- Overlay content -->
<div class="overlay-content">
<a href="index.html">Home</a>
<a href="about.html">About</a>
<a href="services.html">Services</a>
<a href="blog.html">Blog</a>
<a href="contact.html">Contact Us</a>
</div>
</div>
<!-- Use any element to open/show the overlay navigation menu -->
<i class="fa fa-bars fa-2x" aria-hidden="true"></i>
</nav>