EduardET

Play the video related to the video thumbnails on click

Feb 14th, 2018
154
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <script>
  2. ( function( $ ) {
  3.     $( document ).ready( function() {
  4.         setTimeout( function() {
  5.             var slider = $( '.wpc-video-slider' ),
  6.                 thumbnails = $( '.wpc-video-slider .et_pb_video_overlay_hover' );
  7.             thumbnails.each( function() {
  8.                 $( this ).click( function() {
  9.                     var slideID = $( this ).parent().parent().data( 'slide-id' ),
  10.                         slide = $( '.wpc-video-slider .et_pb_slides .et_pb_slide' ).eq( slideID ),
  11.                         videoCover = slide.find( '.et_pb_video_overlay' ).css( {
  12.                             'opacity': 0,
  13.                             'display': 'none'
  14.                         } ),
  15.                         video = slide.find( 'video' ).get( 0 );
  16.                     video.play();
  17.                 } )
  18.             } )
  19.         }, 100 )
  20.     } );
  21. } )( jQuery );
  22. </script>
Advertisement
Add Comment
Please, Sign In to add comment