• Resolved casparsmits

    (@casparsmits)


    Hello everyone,

    I’m trying to find out how to add a pause/play button to the Anything Slider. I have it on autoplay and it shows the arrows, but I’d like users to pause the slider when they want to. Does anyone know how I can do that?

    Best,
    Caspar

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author simonpedge

    (@simonpedge)

    Hi Caspar,
    Have a look at the Owl Carousel documentation for provided events:
    https://owlcarousel2.github.io/OwlCarousel2/docs/api-events.html

    So looking at the AutoPlay events, I think you would use JavaScript like the following:

    var owl = jQuery('#SLIDER_ID');
    jQuery('#BUTTON_PLAY').click(function() {
        owl.trigger('play.owl.autoplay');
    })
    jQuery('#BUTTON_STOP').click(function() {
        owl.trigger('stop.owl.autoplay');
    })

    You will need to replace the CSS IDs above for ‘#SLIDER_ID’ (the CSS ID of your slider, ‘#BUTTON_PLAY’ and ‘#BUTTON_STOP’, which will be the CSS IDs assigned to 2 button elements on your page.

    Thread Starter casparsmits

    (@casparsmits)

    Hi Simon,

    Thank you so much for your help! This worked perfectly. I made one button that pauses and plays using the Autoplay events you provided.

    Best,
    Caspar

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Pause / play button’ is closed to new replies.