Visibility属性已停止在Chrome中为我工作 [英] Visibility attribute stopped working in chrome for me

查看:312
本文介绍了Visibility属性已停止在Chrome中为我工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在几个月前创建了一个网络应用程序,并测试它在工作正常,即,ff& chrome。

I created a web app some months ago and tested it working fine in ie, ff & chrome.

我昨晚添加了一些东西,发现我的隐藏iframe函数在chrome中不再工作。

i went to add something last night and noticed that my hide iframe function is no longer working in chrome.

如果我检查的元素,我可以看到属性确实改变,但iframe不隐藏。

If i inspect the element i can see the attribute is indeed changing, but the iframe is not hidden.

function hideIFrame(){
    document.getElementById("myFrame").style.visibility="hidden";
    self.focus();
}

function showIFrame(){
    document.getElementById("myFrame").style.visibility="visible";
}

myFrame div开始隐藏。并且已成功可见,但是当可见性更改为隐藏的chrome不隐藏它,ff和ie隐藏它仍然。

the myFrame div starts off hidden. and is made visible successfully but when the visibility is changed to hidden chrome is not hiding it, ff and ie do hide it still.

任何想法为什么?

FIX:

function hideIFrame(){
    document.getElementById("myFrame").style.visibility="hidden";
    document.getElementById("myFrame").style.opacity=0;
    self.focus();
}

function showIFrame(){
    document.getElementById("myFrame").style.visibility="visible";
    document.getElementById("myFrame").style.opacity=1;
}


推荐答案

iframe visibility切换( $('iframe')。css('visibility','隐藏)在谷歌Chrome 不工作)。如果你想要消失,使用height,width:0。如果你想让它只是隐形,使用不透明度:0。

There are problems with iframe visibility toggling ($('iframe').css('visibility','hidden') not working in google chrome). If you want it to disappear, use height, width:0. If you want it to simply be invisible, use opacity:0.

这篇关于Visibility属性已停止在Chrome中为我工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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