简体   繁体   中英

jQuery menu not working on server but working properly on localhost

In https://harissonsbags.com jquery menu not working but the same code is working properly on localhost.

This is the code snippent.

jQuery(document).ready(function( $ ) {
    $("#mobile-menu").mmenu({
        classes: 'mm-light'
    }, {
        selectedClass: "active",
    });
});

I ran this code on javascript console on the website.

jQuery("#mobile-menu").mmenu({
        classes: 'mm-light'
    }, {
        selectedClass: "active",
    });

Then the menu accordion is working. While page loading the javascript is not executing.

Any suggestion would help.

You may need to load jquery library before all other plugins

无法看到jQuery版本

没有jQuery文件

Your page has some JavaScript errors pertaining to this code below:

var el = document.getElementById("zipcode");

el.onkeyup = function(evt) {
    var fieldValue = el.value;
    if(fieldValue.length == 6) {
        codeAddress(fieldValue);
    }
};

Fixing this should fix your menu as this code is not in an document ready tag it is running first and causing all other JavaScript to not execute.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM