Fancybox not displaying YouTube video since iOS6

后端 未结 1 635
無奈伤痛
無奈伤痛 2021-01-16 02:20

This is the code I have been using for the last year. It works great!

$(\"#videos a\").click(function() {
    if ($(this).hasClass(\'youtube\')) {
        $.         


        
相关标签:
1条回答
  • 2021-01-16 03:03

    To make your youtube videos more accessible across different platforms you should stop using the format http://www.youtube.com/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.com/watch?v=3l8MwU0IjMI">open youtube video in fancybox</a>
    

    ... do this :

    <a class="fancybox" href="http://www.youtube.com/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"
    });
    
    0 讨论(0)
提交回复
热议问题