Skip to content

Autoplay video from beginning every time? #638

Answered by NaotoshiFujita
jaybonthius asked this question in Q&A
Discussion options

You must be logged in to vote

Didn't test it, but like this:

var elms = document.getElementsByClassName( 'splide' );

for ( var i = 0; i < elms.length; i++ ) {
  var splide = new Splide( elms[ i ], {} );
  
  splide.on( 'active', function ( Slide ) {
    var slide = Slide.slide;
    console.log( slide ); // slide element

    var video = slide.querySelector( 'video' );

    if ( video ) {
      console.log( video ); // video element
    }
  } );

  splide.mount();
}

Replies: 4 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@jaybonthius
Comment options

Answer selected by NaotoshiFujita
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants