jQuery tubeplayer - 用于停止页面中任何视频的链接

时间:2012-10-30 15:20:29

标签: php jquery jquery-plugins youtube-javascript-api

使用jQuery tubeplayer,如何设置一个停止任何视频嵌入的按钮?

我尝试使用php渲染多个视频:

echo '
<div class="video_frame">
<script type="text/javascript">
$(".video_frame").tubeplayer({
width: 960, // the width of the player
height: 390, // the height of the player
allowFullScreen: "true", // true by default, allow user to go full screen
initialVideo: "'.$destaque_g['video'].'", // the video that is loaded into the player
preferredQuality: "default",// preferred quality: default, small, medium, large, hd720
onPlay: function(id){}, // after the play method is called
onPause: function(){}, // after the pause method is called
onStop: function(){}, // after the player is stopped
onSeek: function(time){}, // after the video has been seeked to a defined point
onMute: function(){}, // after the player is muted
onUnMute: function(){} // after the player is unmuted
});
</script>
<div>';

并将其称为头文档标记:

$('.stripe_bottom').find('a').click(function() {
$('.video_frame').tubeplayer('stop');
});

我希望div中带有'stripe_bottom'类的任何标记'a'都可以使用类'video_frame'停止任何div内的视频。

当我点击'stripe_bottom'内的链接时,第一个视频停止了,但另一个视频将不会停止。

任何人都可以帮忙吗?

1 个答案:

答案 0 :(得分:0)

试试这个:

$('.stripe_bottom').find('a').click(function() {
    $('.video_frame').each(function(){$(this).tubeplayer('stop');});
});