• Resolved pleinx

    (@pleinx)


    Hello,

    how i can manually initialize a already present carousel afterwards?
    In my special case the carousel is hidden behind a tab, once the tab gets active, i want to initialize the carousel.

    On older versions of metaslider i used this code snippet, which does not longer work:

    jQuery(‘.metaslider-flex’).trigger(‘focus’);
    jQuery(‘.metaslider-flex’).trigger(‘resize’);

    Thanks in advance

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author htmgarcia

    (@htmgarcia)

    Hi @pleinx,

    you can use ‘metaslider/initialized’ event

    (function($) {
    $(document).on('metaslider/initialized', function (e, identifier) {
    /* Your code goes here */
    });
    })(jQuery)

    Regards

    Thread Starter pleinx

    (@pleinx)

    @htmgarcia thanks for your reply.

    Not sure, how this should solve my issue. Your code-snippet shows how to react once the carousel is initialized. I need a trigger, to re-initialize a carousel e.g. after ajax.

    So the webserver provides new HTML for a carousel from backend. Once the ajax is ready i want to initialize this carousel like: jQuery('metaslider[id=1234]').init()

    Plugin Author htmgarcia

    (@htmgarcia)

    MetaSlider uses Flexslider library as default. There are some methods to change the status/content of the slideshow such as addSlide() in case you want to add new slides content on the fly. Use with caution.

    Link to Flexslider docs: https://github.com/woocommerce/FlexSlider

    Regards

    Thread Starter pleinx

    (@pleinx)

    I don’t wanna change the status or content. How you initialize a slider? ?? There must be a function-call. This one i need please.

    Plugin Author htmgarcia

    (@htmgarcia)

    The method is $('#metaslider_ID').flexslider() (where ID is the actual slideshow id).

    Regards

    Thread Starter pleinx

    (@pleinx)

    Thank you again for your reply.
    But sadly this will not work ??


    $('#metaslider_4689').flexslider();
    VM3707:1 Uncaught TypeError: $(…).flexslider is not a function

    Plugin Author Steve Burge

    (@stevejburge)

    Hi @pleinx. Please don’t bump thread. Our support here on the WordPress forums will not always happen immediately. The support options are here: https://www.metaslider.com/support/

    Plugin Author htmgarcia

    (@htmgarcia)

    Hi @pleinx

    $('#metaslider_4689').flexslider(); code is already added and executed through MetaSlider, so be careful to not duplicate flexslider instances. Additionally the error $(…).flexslider is not a function means you added your custom code before loading the library that requires that code, in this case flexslider.

    Regards

Viewing 8 replies - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.