How did I mess the dropdown submenu on "Rugby Tours"?


I thought yesterday everything was working, this morning I discovered the dropdown menu on mobile didnt show, I “fixed” it with some class adding and removing on jquery on base.php, before body tag. That fixed the dropmenu on mobile.

Now I have this problem: when you click on rugby tours it should just show a dropdown submenu but it behaves instead as a link to the “rugby tours” page

Where is the bug?

I can’t speak to your original issue as I can’t see it but your second problem doesn’t look like a bug so much as your dropdown has a link target so it’s behaving like a link. i.e:

<li class="dropdown menu-rugby-tours"><a class="dropdown-toggle" data-toggle="dropdown" data-target="#" href="/rugby-tours/">Rugby Tours <b class="caret"></b></a>

should be:

<li class="dropdown menu-rugby-tours"><a class="dropdown-toggle" data-toggle="dropdown" data-target="#" href="#">Rugby Tours <b class="caret"></b></a>

Hi @pelayo_mao,

Could you post what you did to fix the first issue?
Also, I did not see any reference to Bootstrap JS or scripts.min.js enqueued in the source (which includes it). That might be causing an issue.
With Bootstrap JS it would not matter if your dropdown toggle had a link target or not as the JS prevents it from behaving as a real link.

I got the js from the dropdown.js file and pasted it before the body into script tags, and it works again… thankyou

So I think the issue is what I suspected. You are missing the Bootstrap JS

Could you paste the code you have in lib/scripts.php?


<?php /** * Enqueue scripts and stylesheets * * Enqueue stylesheets in the following order: * 1. /theme/assets/css/main.min.css * * Enqueue scripts in the following order: * 1. jquery-1.10.2.min.js via Google CDN * 2. /theme/assets/js/vendor/modernizr-2.6.2.min.js * 3. /theme/assets/js/main.min.js (in footer) */ function roots_scripts() { wp_enqueue_style('roots_main', get_template_directory_uri() . '/assets/css/main.min.css', false, '9a2dd99b82ca338b034e8730b94139d2'); // jQuery is loaded using the same method from HTML5 Boilerplate: // Grab Google CDN's latest jQuery with a protocol relative URL; fallback to local if offline // It's kept in the header instead of footer to avoid conflicts with plugins. if (!is_admin() && current_theme_supports('jquery-cdn')) { wp_deregister_script('jquery'); wp_register_script('jquery', '//', false, null, false); add_filter('script_loader_src', 'roots_jquery_local_fallback', 10, 2); } if (is_single() && comments_open() && get_option('thread_comments')) { wp_enqueue_script('comment-reply'); } wp_register_script('modernizr', get_template_directory_uri() . '/assets/js/vendor/modernizr-2.6.2.min.js', false, null, false); wp_register_script('roots_scripts', get_template_directory_uri() . '/assets/js/scripts.min.js', false, '2a3e700c4c6e3d70a95b00241a845695', true); wp_enqueue_script('modernizr'); wp_enqueue_script('jquery'); wp_enqueue_script('roots_scripts'); } add_action('wp_enqueue_scripts', 'roots_scripts', 100); // function roots_jquery_local_fallback($src, $handle = null) { static $add_jquery_fallback = false; if ($add_jquery_fallback) { echo '' . "\n"; $add_jquery_fallback = false; } if ($handle === 'jquery') { $add_jquery_fallback = true; } return $src; } add_action('wp_head', 'roots_jquery_local_fallback'); function roots_google_analytics() { ?> <?php } if (GOOGLE_ANALYTICS_ID && !current_user_can('manage_options')) { add_action('wp_footer', 'roots_google_analytics', 20); }

No, I can´t, I dont remember :frowning:
Yes, bootstrap.js is there:

now is working fine so :sunny: I 100% finished:

Thankyou very much