jQuery 在模态中播放视频

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/10729299/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-26 09:41:29  来源:igfitidea点击:

Playing a Video in a Modal

jqueryhtmlcssmodal-dialog

提问by Joe Bobby

Are there any modals that can play youtube, vimeo, and videos uploaded to the website? I have been searching and can't find to many examples of modals

有没有可以播放youtube、vimeo和上传到网站的视频的模态?我一直在搜索,但找不到很多模态的例子

回答by Marko

Yes, one example is Fancybox.

是的,一个例子是Fancybox

Here's a bunch of samplesfor using Vimeo, you can easily change to YouTube etc.

这里有一堆使用 Vimeo的示例,您可以轻松切换到 YouTube 等。

回答by Alnitak

There's no such thing as a built-in modal in HTML / JS.

HTML / JS 中没有内置模式这样的东西。

However to implement a modal all you need is nothing more than a full window sized div between your player and the background content (using the z-indexstyle property) that prevents events from reaching the elements underneath it.

但是,要实现模态,您只需要在播放器和背景内容(使用z-indexstyle 属性)之间设置一个全窗口大小的 div ,以防止事件到达其下方的元素。