I've been trying to figure out why my jQuery isn't properly working with my custom Wordpress website?
Here's my functions.php file
<?php
function customcode_theme_styles() {
wp_enqueue_style('customcode-css', get_template_directory_uri() . '/style.css');
}
add_action ('wp_enqueue_scripts', 'customcode_theme_styles');
function customcode_theme_js() {
wp_enqueue_script('easing-js', get_template_directory_uri() . '/js/jquery.easing.1.3.js', array('jquery'));
wp_enqueue_script('animate-enhanced-js', get_template_directory_uri() . '/js/jquery.animate-enhanced.min.js', array('jquery'));
wp_enqueue_script('superslides-js', get_template_directory_uri() . '/js/jquery.superslides.min.js', array('jquery'));
wp_enqueue_script('customcode-js', get_template_directory_uri() . '/js/customcode.js', array('jquery'));
}
add_action ('wp_enqueue_scripts', 'customcode_theme_js');
?>
Now I am able link my CSS perfectly fine, but anything jQuery isn't properly linking?
Here's the customcode.js file I am trying to link my functions.php to:
$(window).scroll(function() {
if ($(document).scrollTop() > 50) {
$('.navbar').addClass('nav-scroll');
} else {
$('.navbar').removeClass('nav-scroll');
}
});
Am I missing something? Let me know, any help is much appreciated thanks!