Hello Steven,
Thanks this helped. It is however not that simple in Wordpress to add JQuery to a page. Also we have an older theme.
I added this to the wordpress functions.php file
function my_theme_scripts() {
wp_enqueue_script( 'my-great-script', get_template_directory_uri() . '/js/menu_fix.js', array( 'jquery' ), '1.0.0', true );
}
add_action( 'wp_enqueue_scripts', 'my_theme_scripts' );
And I made a js file callled menu_fix.js and addded your code.
Site with explanation https://premium.wpmudev.org/blog/adding … wordpress/
This worked, so it is fixed. Did not test on other devices
You can also add css-classes to menu items. So maybe it could also be done that way.
Thanks a lot!