下面的代码可以工作,但它可以同时在DOM中播放projekktor视频播放器的所有实例。我如何修改代码,使其只播放与我单击的.startb相同的父div中的视频?
html
<div class="videoContainer">
<div class="playerHolder">
<div class="videoPlayer"><video class="projekktor" poster="poster.jpg" title="" width="640" height="385" controls>
<source src="video.mp4" type="video/mp4" />
<source src="video.webm" type="video/webm" />
</video></div>
<div class="startb"><img src="dbs/images/start.png"/></div>
<div class="postImage"><img src="006_CCC_Magdelena_poster.jpg" title="" width="640" height="385" /></div>
</div>
</div>js
$('.startb').click(function() {
projekktor('*').each(function() {
this.setPlay();
});
}); 发布于 2012-02-17 00:59:55
试试这个:
$('.startb').click(function() {
$(this).parent('div').find('.projekktor').setPlay();
}); https://stackoverflow.com/questions/9315001
复制相似问题