开发者

How to Access Elements in FancyBox iframe

开发者 https://www.devze.com 2023-04-09 18:40 出处:网络
There is an iframe, opened in fancybox window. The content of the iframe is external. Is there a way to access this content and to change the style 开发者_如何学Goof one of the elements?Since the ifra

There is an iframe, opened in fancybox window.

The content of the iframe is external.

Is there a way to access this content and to change the style 开发者_如何学Goof one of the elements?


Since the iframe has contents from the same domain, access the iframe using contents() like this:

$('#fancybox-content iframe').contents().find('.selector')


If the iFrame is on another domain you can't access it in any way due to browser restriction. This is called same origin policy.

One thing that can get around it is the greasmonkey extension for firefox (this has no actual utility, it's just to let you know this fact if you are interested)

0

精彩评论

暂无评论...
验证码 换一张
取 消