Search code examples
javascriptjqueryhtmlvideoslide

Pause video on slider


I am creating a slider with images that when someone clicks one slide, opens a modal window with another slider with videos.

At the moment, when you click one of the images, it opens a video that auto plays. The problem is that if you click to see the next slide, the video keeps playing.

So I would like to pause the video when the slide moves...

Here is a fiddle


Solution

  • I found the solution, thanks to @lonut who pointed me in the right direction:

    var iframe = $('.vimeo-player')[0];
    var player = $f(iframe);
    
    $('.carousel-control').bind('click', function() {
        player.api('pause');
    });