Issues loading Jquery on WordPress website

Question

Please assist, I am trying to load this Jquery on my WordPress website with no luck.

I have used this script just BEFORE the </body> tag in my functions.php :

<script type="text/javascript"
   src="<?php bloginfo("template_url"); ?>/js/menu-hover.js"></script>

I have used this code in the of my functions.php file:

<?php
if (!is_admin()) add_action("wp_enqueue_scripts", "my_jquery_enqueue", 11);
function my_jquery_enqueue() {
   wp_deregister_script('jquery');
   wp_register_script('jquery', "http" . ($_SERVER['SERVER_PORT'] == 443 ? "s" : "") . "://ajax.googleapis.com/ajax/libs/jquery/js/jquery.min.js", false, null);
   wp_enqueue_script('jquery');
}
?>

This is my Jquery/Javascript code:

jQuery( "#panel-2-1-0-0" ).hover( //Print and Document
    function() {
        jQuery('#mega-menu-item-475').addClass('mega-toggle-on');
    }, function() {
        jQuery('#mega-menu-item-475').removeClass('mega-toggle-on');
    }
);

jQuery( "#panel-2-1-1-0" ).hover( //Telecom
    function() {
        jQuery('#mega-menu-item-477').addClass('mega-toggle-on');
    }, function() {
        jQuery('#mega-menu-item-477').removeClass('mega-toggle-on');
    }
);

jQuery( "#panel-2-1-0-1" ).hover( //IT Dev
    function() {
        jQuery('#mega-menu-item-476').addClass('mega-toggle-on');
    }, function() {
        jQuery('#mega-menu-item-476').removeClass('mega-toggle-on');
    }
);

jQuery( "#panel-2-1-1-1" ).hover( // Safety and Security
    function() {
        jQuery('#mega-menu-item-478').addClass('mega-toggle-on');
    }, function() {
        jQuery('#mega-menu-item-478').removeClass('mega-toggle-on');
    }
);
0
, Bradley 4 years 2017-10-19T02:13:57-05:00 0 Answers 71 views 0

Leave an answer

Browse
Browse