javascript - How to play one video in jQuery tab and stop others? -


i have 4 jquery tabs, in each tab there 2 videos. how make 1 video play @ time , pause others? , how make video pause when switch new tab?

this code jsfiddle

/* play 1 video @ time */  $('video').bind('play', function() {   activated = this;   $('video').each(function() {       if(this != activated) {           this.pause();       }   }); });  /* active tab */ var active = $( "#issuestabs" ).tabs( "option", "active" );    /* pause videos not in active tab*/   if (!active) {     $("video").each(function(){         $(this).get(0).pause();     });  } 

can show me wrong?

thanks!

can use:

$('.tab').on('click', function() {   $('.tabcontent:hidden').find('video').each(function() {     $(this).get(0).pause();   }); }); 

(where .tabcontent name of content panels hidden/shown, click function showed example since not know library using tabs.)


Comments

Popular posts from this blog

java - Run a .jar on Heroku -

java - Jtable duplicate Rows -

validation - How to pass paramaters like unix into windows batch file -