ユーザーが次のスライドをクリックすると一時停止しようとしているスライドショー (Cycle Plugin を使用した MaxImage) に埋め込まれた YouTube ビデオがあります。HTML5 ビデオ用の組み込み関数がありますが、YouTube 用に同じことを行う方法がわかりません。ありがとう!
before 関数と after 関数に注意してください。
$(function(){
$('#maximage').maximage({
cycleOptions: {
fx: 'fade',
speed: 600,
timeout: 0,
prev: '.prev',
next: '.next',
pause: 1,
before: function(last,current){
if(!$.browser.msie){
// Start HTML5 video when you arrive
if($(current).find('video').length > 0) $(current).find('video')[0].play();
}
},
after: function(last,current){
if(!$.browser.msie){
// Pauses HTML5 video when you leave it
if($(last).find('video').length > 0) $(last).find('video')[0].pause();
}
},
onFirstImageLoaded: function(){
jQuery('#loader').hide();
jQuery('#maximage').fadeIn(200);
}
});
});