$('iframe').css('visibility','hidden')在谷歌浏览器中不起作用 [英] $('iframe').css('visibility','hidden') not working in google chrome

查看:1116
本文介绍了$('iframe').css('visibility','hidden')在谷歌浏览器中不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用类似于

  $('ul li')。find('iframe')。css({ '可见性': '可见'}); 

极好的在Firefox和Opera中,

控制台错误:

不安全的JavaScript尝试访问带有URL文件的帧:/// D:/ Configuracion / Documents%20and%20Settings / TNMC000 / Escritorio /player/roundabout/js/round1.htm,网址为 http://www.youtube.com/embed / hurnoKLuBD8 的。域名,协议和端口必须匹配。



测试网址: http://toniweb.us/vimeo-like/js/images.htm



有什么想法吗? p>

-EDIT -



我使用

 .invisible {text-indent:-9999px} 

 < div class =iframe>< iframe>< / iframe>< / div> 

  $('ul li')。find('。iframe')。addClass('invisible'); 

但是仍然想知道如何解决它只能使用iframe

解决方案

实际上使iframes不可见(即使用 visibility:hidden 显示:无)。
但是你可以通过足够小的方法让它们消失

  $('ul li')。find('iframe ').css({height:0,width:0,border:none}); 


I am using something like

$('ul li').find('iframe').css({'visibility':'visible'});

wich works fine In Firefox and Opera,

console error:

Unsafe JavaScript attempt to access frame with URL file:///D:/Configuracion/Documents%20and%20Settings/TNMC000/Escritorio/player/roundabout/js/round1.htm from frame with URL http://www.youtube.com/embed/hurnoKLuBD8. Domains, protocols and ports must match.

Test URL: http://toniweb.us/vimeo-like/js/images.htm

any idea?

-EDIT-

I fixed it using

.invisible{ text-indent:-9999px }

and

<div class="iframe"><iframe></iframe></div>

and

$('ul li').find('.iframe').addClass('invisible');

But still would like to know how to fix it working with only the iframe

解决方案

There are issues with actually making iframes invisible (i.e. using visibility:hidden or display:none). But you can make them disappear by being small enough

$('ul li').find('iframe').css({"height":"0", "width":"0", "border":"none"});

这篇关于$('iframe').css('visibility','hidden')在谷歌浏览器中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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