私は 4 つの Jquery タブを持っています。各タブには 2 つのビデオがあります。一度に 1 つのビデオを再生し、他のすべてのビデオを一時停止するにはどうすればよいですか? 新しいタブに切り替えたときにビデオを一時停止するにはどうすればよいですか?
これはコードJsfiddleです
/* play one video at a time */
$('video').bind('play', function() {
activated = this;
$('video').each(function() {
if(this != activated) {
this.pause();
}
});
});
/* get the active tab */
var active = $( "#issuestabs" ).tabs( "option", "active" );
/* pause all videos that are not in the active tab*/
if (!active) {
$("video").each(function(){
$(this).get(0).pause();
});
}
誰が何が間違っているのか教えてもらえますか?
ありがとう!