强制固定导航栏在iframe的顶部? [英] Force fixed nav bar on top of iframe?

查看:681
本文介绍了强制固定导航栏在iframe的顶部?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将导航固定在页面顶部,但如果在其上滚动嵌入了iframe的YouTube视频,则它会显示在导航(以及任何叠加层或模态窗口div)的顶部。

I have navigation fixed to the top of my page, but if an iframe-embedded youtube video is scrolled over it, it shows up on top of the nav (as well as any overlay or modal window-div).

尝试在其上设置z-index,无效。

Tried setting the z-index on it, to no avail.

我发现你可以在嵌入对象上设置wmode =opaque,以使用旧样式flash嵌入,但我更喜欢使用HTML 5,而不需要在视频嵌入的特定设置

I've found that you can set wmode="opaque" on the embed object to get this to work with an old style flash embed, but I'd prefer to work with HTML 5 and not have to require specific settings on a video embed

http://jsfiddle.net/EB6gN/9/ ​​ p>

http://jsfiddle.net/EB6gN/9/

推荐答案

正确的答案是将 wmode = opaque 设置为iframe的YouTube查询字符串 src 值。

The correct answer is to set wmode=opaque as a YouTube Query String for your iframes src value.

对于iframe,没有属性不透明。允许的属性完整列表如下:
http:// www.w3schools.com/tags/tag_iframe.asp

There is no attribute Opaque for iframes. Complete list of allowed attributes are here: http://www.w3schools.com/tags/tag_iframe.asp

此更新的jsfiddle只包含 HTML5 API嵌入YouTube方法,输出旧样式嵌入类型和您不想要的z-index。

http://jsfiddle.net/EB6gN/16/

This updated jsfiddle contains only the HTML5 API Embed YouTube Method, leaving out the old-style embed type and the z-index that you don't want.
http://jsfiddle.net/EB6gN/16/

如果您在视频上点击播放时看到黑屏,则是因为当前的YouTube HTML5 Flash后备广告错误。当iframe尺寸较大时,您会看到控件,但播放器已损坏。参考此信息的信息:

http://stackoverflow.com/a/10560802/1195891

If you click play on your videos see a black screen, it's because of the current YouTube HTML5 Flash Fallback bug. You will see the controls once the iframe is a larger size, but the player is broken. Reference this SO post for that info:
http://stackoverflow.com/a/10560802/1195891

这篇关于强制固定导航栏在iframe的顶部?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆