I have a problem on my website with the lastest version wordpress.
I have a display problem with my drop down menu.
The right version (official website) : https://www.colinvautiercoiffeur.fr/
The version with the problem (site test) : https://test.trazdd.site/
I tried to install a plugin migrate javascript but it doesn’t work.
Have you got a code to fix that?
Thanks
If I swap that script into your new page then it all starts working.
As JS (or wordpress) is not my area I will leave it to the JS gurus to point you in the right direction as this is not a css or html issue. It looks like you need the old version of jquery.
There is an undefined error for the variable called rightW.
var rightW = $('.top_bar_right').innerWidth();
There doesn’t seem to be a top_bar_right element and so returns undefined and the width never gets set on top_bar_left.
var leftW = parentW - rightW;
$('.top_bar_left, .menu > li > ul.mfn-megamenu').css('width', leftW);
It’s that lack of width that is breaking your top menu.
If I check for undefined and set a zero value if not found then the page starts to work.
e.g.
var rightW = 0;
rightW = $('.top_bar_right').innerWidth();
if (typeof rightW === "undefined") {
rightW = 0;
}
Here is the section to replace with the extra code in place.
/* ---------------------------------------------------------------------------
* Header | Top bar left | Width
* --------------------------------------------------------------------------- */
function mfn_header() {
var rightW = 0;
rightW = $('.top_bar_right').innerWidth();
if (typeof rightW === "undefined") {
rightW = 0;
}
if (rightW && !$('body').hasClass('header-plain')) {
rightW += 10;
}
var parentW = $('#Top_bar .one').innerWidth();
var leftW = parentW - rightW;
$('.top_bar_left, .menu > li > ul.mfn-megamenu').css('width', leftW);
}
Try replacing that section of code and see if it sorts the issue for you. If not then you’ll have to wait for someone more knowledgable in JS to come along
it’s very strange, i copy your code on my files
you can see my ftp photo
On Google chrome, nothing changes
Must i copy my javascript folder in my child theme?
Hi, it sounds like a Wordpress issue to me and maybe your theme plugin is cached. I don’t do WordPress but theres some info here about the wordpress cache (as opposed to browser cache).
Sometimes renaming the file can help avoid only the cached file being retrieved but I don’t know if that applies to wordpress and it all gets bundled together.