fancyBox - YouTube Video Won't Display

China☆狼群 提交于 2019-12-02 11:59:16
JFK

The issue is that this URL format

http://www.youtube.com/watch?v=PzBk4-awY40

...won't work with iframe mode (you are setting fancybox.iframe class in your link).

You may rather use youtube's embedded format, which works on devices that don't support flash

http://www.youtube.com/embed/PzBk4-awY40

Additionally, you can add the ?autoplay=1 trailing parameter if you want your videos to start right after fancybox is opened

JSFIDDLE

NOTES:

  • If you really want to stick to the /watch?v= URL format (the links are set by the user or dynamically) then remove the class fancybox.iframe from your link and use the fancybox media helper instead. Check http://fancyapps.com/fancybox/#examples ==> extended functionality for more.
  • to avoid a known iframe issue (mostly with IE) I would advise you to set iframe preload to false, check https://stackoverflow.com/a/16595607/1055987 for more
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!