Support » Plugin: Accordion » Script optimizers compatibility

  • Resolved ikenfin

    (@ikenfin)


    Hello!

    Why are you using inline javascript in templates/scripts.php? It wont work if i’m using for example Autoptimise and combine scripts in footer.

    I cannot find any repo to contribute, so paste here:

    
    wp_enqueue_script( 'accordions_init_script_' . $post_id, plugins_url( 'assets/frontend/js/init_accordion.js', dirname(__FILE__) ), array('jquery'));
    
    wp_localize_script( 'accordions_init_script_' . $post_id, '$Accordion_settings', array(
        'post_id' => $post_id,
        'collapsible' => $accordions_collapsible,
        'heightStyle' => $accordions_heightStyle
    ) );
    
Viewing 2 replies - 1 through 2 (of 2 total)
  • And init_accordion.js file:

    
    jQuery(document).ready(function($){
      $("#accordions-" + $Accordion_settings.post_id + ".accordions").accordion({
        active: "",
        event: "click",
        collapsible: $Accordion_settings.collapsible,
        heightStyle: $Accordion_settings.heightStyle,
        animated: "swing"
      })
    });
    
    Plugin Author PickPlugins

    (@pickplugins)

    Thanks for your suggestion,

    I hope this will implement in future version if possible.

    Regards

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Script optimizers compatibility’ is closed to new replies.