2012-02-16 21 views
0

以下のコードは機能しますが、DOM内のprojekktorビデオプレーヤーのすべてのインスタンスを同時に再生します。私がクリックした.startbと同じ親のdiv内でのみビデオを再生するようにコードを修正する方法はありますか?html5プレーヤーを再生

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(); 
    }); 
}); 

答えて

1

これを試してみてください:

$('.startb').click(function() { 
    $(this).parent('div').find('.projekktor').setPlay(); 
}); 
関連する問題