无法在Safari中隐藏youtube iframe? [英] Unable to hide youtube iframes in safari?

查看:161
本文介绍了无法在Safari中隐藏youtube iframe?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我注意到当使用youtube视频时,使用任何隐藏div的典型方法都不适用于safari。看看这个基本网页 -

I've noticed that when using any typical method of hiding a div does not work in safari when a youtube video is in it. Look at this basic webpage-

<!DOCTYPE html>
<html>
<head><title>Safari Test</title></head>
<body>
<div id="test">
<iframe width="560" height="315" src="http://www.youtube.com/embed/Nry5zSJxG9k" frameborder="0" allowfullscreen></iframe>
</div>
<div id="safari" style="display: none;">
<iframe width="560" height="315" src="http://www.youtube.com/embed/Nry5zSJxG9k" frameborder="0" allowfullscreen></iframe>
</div>
</body>
</html>

div现在已隐藏,但请尝试尝试此操作 - 在safari中查看此信息并打开开发人员工具。如果您转到safari div并单击关闭显示,则视频将重新出现。现在,再次点击它以隐藏它,你会发现它没有隐藏。你可能想知道为什么这会成为一个问题?好吧,我正在为youtube视频使用旋转木马,它通过隐藏非活动视频来工作。在safari的最主要版本5.1.7中,视频根本不会消失。有谁知道解决这个问题?我尝试用不透明度,高度,宽度和可见度隐藏它,但你仍然可以在Safari中看到它。有什么想法吗?

The div is hidden now, but try try this- View this in safari and open the developer tools. If you go to the safari div and click off display none the video will reappear. Now, click on it again to hide it and you will notice that it does not hide. Why would this be an issue, you may wonder? Well I'm working with a carousel for youtube videos and it works by hiding inactive videos. In the most reason version of safari, 5.1.7, the videos simply will not go away. Does anyone know a fix for this? I've tried hiding it with opacity, height, width, and visibility but you can still see it there in Safari. Anyone have any ideas?

推荐答案


我试图用不透明度,高度,宽度隐藏它,和可见性,但你仍然可以在Safari中看到它。有什么想法吗?

I've tried hiding it with opacity, height, width, and visibility but you can still see it there in Safari. Anyone have any ideas?

您是否尝试过将iframe移出屏幕?

Did you try physically moving the iframe off the screen?

position: absolute;
left: -10000px;
top: -10000px;

这篇关于无法在Safari中隐藏youtube iframe?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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