Wordpress accordion menu dont work properly

921 Views Asked by At

I have the following page https://german-academic-institute.eu/faqs/ with the WPBakery plugin that has the Accordion menu for FAQs in the middle of the page. All those menus are made to be closed, but for some reason, they are not, and the option to close/open them doesn't work when I click on them. I tested also other collapsable menus and the same thing happens. SO I assume it has to do something with Jquery but can't figure it out.

I could use any help

Thanks.

3

There are 3 best solutions below

4
Lajos Arpad On

Dev Tools and browser Console is your friend. You can reach it by right-clicking on the page and from the menu shown chosing Inspect/Inspect Element (the actual text varies accross browsers). In the Dev Tools if you click on the Console tab, you will see the errors in the browser and can experiment with scripts. Kindly look at this image:

enter image description here

You have rightly guessed that the problem is with jQuery, as your page attempts to reach jQuery with that variable name, however, in your case jQuery is called $.

A quick fix is to create the variable before it is being attempted to be used:

var jQuery = $;

or replacing jQuery with $ in all its occurrence. Kindly note the thought process of the solution:

  • I looked at the error and figured out that the variable is missing
  • I checked whether the variable is called $ instead of jQuery
  • Based on the acquired knowledge I have made a plan and written an answer to you
1
William Harrison On

The datepicker appears to be blocking the accordion functionality from being available.

This is the datepicker "script" in the <head> of the page markup. Searching the page, this is the only instance of datepicker in the markup and as the console shows, blocks other code - such as the accordion - from running

Console showing the error. Since the datepicker is basically at the top of the page, it will prevent JavaScript that is below it from executing

I was unable to even find anything related to the accordion functionality (in terms of the actual script that would have the accordion functionality in it), but after a bit of time in the console, I came up with this ugly jQuery - jQuery(".vc_tta-panel-heading a").click(function(e){e.preventDefault; jQuery(e.target).parents('.vc_tta-panel').children('.vc_tta-panel-body').toggle()}). Which is what the plugin should do. Not exactly an answer, but you might have better luck contacting the plugin author for advisement.

0
AudioBubble On

Go ahead.

<!-- <script src="https://code.jquery.com/jquery-1.11.3.min.js"></script>  --> 
you can update!

<script type="text/javacript">
//replace

  jQuery( function() {
    jQuery( "#datepicker" ).datepicker();
  });

   $(document).ready(function(){
       //include you datepicker function.

   })
  </script>
<!-- Nice once -->

 > note : is good practice include in section 

  > styles
  > html sections
  > tags lines javascript and includes