admin管理员组文章数量:1327693
This is the code I have been using for the last year. It works great!
$("#videos a").click(function() {
if ($(this).hasClass('youtube')) {
$.fancybox({
'padding' : 0,
'autoScale' : false,
'transitionIn' : 'none',
'transitionOut' : 'none',
'title' : this.title,
'width' : $(this).attr('data-width'),
'height' : $(this).attr('data-height'),
'href' : this.href.replace(new RegExp("watch\\?v=", "i"), 'v/'),
'type' : 'swf',
'swf' : {
'wmode' : 'transparent',
'allowfullscreen' : 'true'
}
});
return false;
}
});
When this code was used on the iPad the video would display. If the video wasn't viewable on the iPad you would see a YouTube icon with a crossed out play button.
Since iOS6 this has stopped working. Nothing in the code has changed. Instead you now see a white pop up. Has anyone e across this? Does anyone know the cause?
I am using Fancybox 1.3.4
This is the code I have been using for the last year. It works great!
$("#videos a").click(function() {
if ($(this).hasClass('youtube')) {
$.fancybox({
'padding' : 0,
'autoScale' : false,
'transitionIn' : 'none',
'transitionOut' : 'none',
'title' : this.title,
'width' : $(this).attr('data-width'),
'height' : $(this).attr('data-height'),
'href' : this.href.replace(new RegExp("watch\\?v=", "i"), 'v/'),
'type' : 'swf',
'swf' : {
'wmode' : 'transparent',
'allowfullscreen' : 'true'
}
});
return false;
}
});
When this code was used on the iPad the video would display. If the video wasn't viewable on the iPad you would see a YouTube icon with a crossed out play button.
Since iOS6 this has stopped working. Nothing in the code has changed. Instead you now see a white pop up. Has anyone e across this? Does anyone know the cause?
I am using Fancybox 1.3.4
Share asked Nov 13, 2012 at 11:15 user1326244user1326244 4191 gold badge6 silver badges15 bronze badges1 Answer
Reset to default 9To make your youtube videos more accessible across different platforms you should stop using the format http://www.youtube./watch?v=3l8MwU0IjMI
(which uses a swf player) but use the embed
method instead (you can get the right code from youtube selecting the share
tab)
So, instead of this :
<a class="fancybox" href="http://www.youtube./watch?v=3l8MwU0IjMI">open youtube video in fancybox</a>
... do this :
<a class="fancybox" href="http://www.youtube./embed/3l8MwU0IjMI?autoplay=1">open youtube video in fancybox</a>
Then modify your fancybox (v1.3.4) script to open the content type
to iframe
like
$(".fancybox").fancybox({
"width": 620, // or whatever
"height": 420,
"type": "iframe"
});
本文标签: javascriptFancybox not displaying YouTube video since iOS6Stack Overflow
版权声明:本文标题:javascript - Fancybox not displaying YouTube video since iOS6 - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742220504a2435367.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论