Support » Plugin: Responsive Slider by MetaSlider - Slider and Carousel Plugin for WordPress » Calling my own JS for Flexslider not working

  • Resolved Sho-Down

    (@sho-down)


    I copied all contents inside jquery.flexslider.min.js and pasted it into my own flexslider.js file and then I call my file with the code below in functions.php. This was working fine before I updated to the latest Metaslider. What am I missing here?

    //Flexslider for Meta Slider
    function flex_slider_script() {
    $detect = new Mobile_Detect();
    if (is_home() && !$detect->isMobile() ) {
    wp_enqueue_script( 'meta-flexslider', get_stylesheet_directory_uri() . '/scripts/flexslider.js', array('jquery'), '2.6.4', true );
    }}
    add_action( 'wp_enqueue_scripts', 'flex_slider_script', 9999);

    If I turn on “Print JS” in the options everything works fine, if I turn it off and use my own JS I get no left/right arrows or “dots” and the slider doesn’t slide.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Contributor kbatdorf

    (@kbat82)

    We upgraded the FlexSlider version and had to alter the base styling to accommodate to FlexSlider’s changes over the years. Could this be the reason?

    It would seem that if I just copied over all the contents of the jquery.flexslider.min.js file into my own js file it should work, so I’m not sure what’s going on. That’s the only javascript file MetaSlider is calling right? If I have Flexslider selected.

    I suppose it’s not an issue, jquery.flexslider.min.js loads at the bottom and only on pages where the slider is present so I guess I can live with the plugin loading it’s own file.

    Plugin Contributor kbatdorf

    (@kbat82)

    Hey @sho-down,

    Sorry for the delay. Actually, I misunderstood your initial concenr. Ihe problem is that we add in the function to initialize the slideshow “inline” right after we call the FlexSlider script. So, if you want to disable JS (as in, uncheck Print JS), then you have to initialize it yourself. It’s a little advanced, but you can find the instructions and options for that here:

    https://github.com/woocommerce/FlexSlider

    @kbatdorf totally forgot about the inline js, thanks.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Calling my own JS for Flexslider not working’ is closed to new replies.