私は自分でこの問題を抱えており、見つけた既存のスニペットに基づいて新しいVimeoIFRAMEのビデオを埋め込むためにこれを解決するためのコードをいくつか作成しました。これにより、FancyboxごとにWIDTHとHEIGHTのURLパラメータを追加できるようになります。それらを追加しない場合、デフォルトでは、90%と90%の高さのIFRAMEが開きます。
(function($){
$(function(){
// Fancybox: IFRAME
var fancybox_iframe = $('.fancybox-iframe');
if (fancybox_iframe.length > 0){
fancybox_iframe.each(function(index){
// Inline frame width param
if( $(this).attr('href').match(/width=[0-9]+/i) ){
var fWidth = parseInt($(this).attr('href').match(/width=[0-9]+/i)[0].replace('width=',''));
} else {
var fWidth = '90%';
}
// Inline frame height param
if( $(this).attr('href').match(/height=[0-9]+/i) ){
var fHeight = parseInt($(this).attr('href').match(/height=[0-9]+/i)[0].replace('height=',''));
} else {
var fHeight = '90%';
}
if(window.console&&window.console.log) {
console.log('fWidth #'+index+': '+fWidth);
console.log('fHeight #'+index+': '+fHeight);
}
$(this).fancybox({
'titlePosition' : 'inside',
'type' : 'iframe',
'autoScale' : true,
'padding' : '10',
'width' : fWidth,
'height' : fHeight,
'centerOnScroll' : true
});
});
}
});
})(jQuery);
これを使用するには、次を使用します。
<a href="http://player.vimeo.com/video/16429685?color=ffffff&width=800&height=450" class="fancybox-iframe" title="Citizen Schools 101">Inline Vimeo Video</a>
これが誰かを助けてくれることを願っています!