InsideDarkWeb.com

jQuery UI Accordion loading very slow

I have a jQuery UI Accordion implemented and as the page loads, you see content of the three headers and tabs for a few seconds, and then they turn into the accordion. I’m not sure which part is causing the delay, and hoping you can help.

In my functions.php:

// Enqueue jQuery accordion
function product_accordion()
{
    if ((is_product()) || (is_archive())){

        wp_enqueue_style('jquery-ui', get_stylesheet_directory_uri() . '/css/jquery-ui.css', 10);
        
        wp_register_script('jquery-core', get_stylesheet_directory_uri() . 'https://code.jquery.com/jquery-1.8.2.js', array('jquery'), '1.0', true);
        wp_enqueue_script('jquery-core');
        
        wp_register_script('jquery-ui', 'https://code.jquery.com/ui/1.9.0/jquery-ui.js', array('jquery'), '1.0', true);
        wp_enqueue_script('jquery-ui');
        
        wp_register_script('accordion-snippet', get_stylesheet_directory_uri() . '/js/accordion-snippet.js', array('jquery'), '1.0', true);
        wp_enqueue_script('accordion-snippet');
        
    }
}
add_action('wp_enqueue_scripts', 'product_accordion');

The accordion-snippet.js enqueued above:

      jQuery('#accordion').accordion({ 
            collapsible:true, 
            active:false, 
            autoHeight: false, 
            disabled:true,
            heightStyle: "content"
      });

      jQuery('#accordion h3.ui-accordion-header').click(function(){
            jQuery(this).next().slideToggle();
      });
      
      jQuery('.accordion-expand-all').click(function(){
            jQuery('#accordion h3.ui-accordion-header').next().slideDown();
      });
      console.log("accordion-snippet.js loaded");

and you can see it here.

What is causing the delay in the Accordion being loaded? And / or any tips on troubleshooting this would be great too.
Please let me know if I need to provide anything else.Thanks!

WordPress Development Asked by bluedimensional on November 11, 2021

0 Answers

Add your own answers!

Related Questions

How to incluide custom field in WooCommerce email using placeholder

0  Asked on December 8, 2020 by santiago-cuartas-rmrz

 

Adding microdata using Structured Data Markup Helper HTML

1  Asked on December 6, 2020 by desislava-angelova

     

Server timeout error on every weekend

0  Asked on December 6, 2020 by dhaval-joshi

 

How do I make a shortcode to display the shop name on Dokan?

1  Asked on December 5, 2020 by sean-taylor

 

Excess dependencies

1  Asked on December 5, 2020 by lovor

   

A conditional button

1  Asked on December 3, 2020 by aashish-tripathi

       

Visual editor not saving data

0  Asked on December 2, 2020 by jasierok

     

WordPress Register Form

0  Asked on November 30, 2020

   

New post status for custom post type

3  Asked on November 30, 2020 by dclawson

   

Showing related post for custom taxonomy

1  Asked on November 28, 2020 by luca

 

How to hide “Change role to” dropdown on Users admin menu

0  Asked on November 27, 2020 by rijal-islami

     

Colliding custom permalink rules

0  Asked on November 26, 2020 by laurent

   

how to redirect the link to a category in the website

1  Asked on November 26, 2020 by jeline

 

Ask a Question

Get help from others!

© 2021 InsideDarkWeb.com. All rights reserved.