0

I'm trying to add a class to a div, which is in an iframe, plus the Fancybox iframe. After trying for hours, I can't get it to work. The console log test prints out, so I'm not sure what I'm doing wrong. It's Fancybox version 1.3.4.

jQuery( ".lightbox" ).fancybox( {
    'width'        : '100%',
    'height'       : '90%',
    'transitionIn' : 'none',
    'transitionOut': 'none',
    'type'         : 'iframe',
    onComplete: function() {
        jQuery('#fancybox-frame' ).contents().find('#right_container').addClass('test123');
        jQuery('#right_container').addClass('test321');
            console.log('test');
        }

Here's the page: http://www.rescue3international.com/onlinetraining.php

Any help would be appreciated. Thanks!

4

1 回答 1

0

不,我收到很多错误/警告。

因此,在您的页面中,内容是使用 iframe 加载的,然后单击时,fancybox 会加载到另一个 iframe 中。你能console.log(jQuery('#fancybox-frame'));吗?我不能在这里做,因为 iframe url 重定向到父 url。

我认为,您无法获取 iframe 内容,因为警告显示了浏览器显示的安全错误。

Invalid 'X-Frame-Options' header encountered when loading 'http://earthexperience.com/r3/faq': 'GOFORIT' is not a recognized directive. The header will be ignored. 

Blocked a frame with origin "http://www.rescue3international.com" from accessing a frame with origin "http://earthexperience.com". Protocols, domains, and ports must match.
于 2013-08-23T06:30:22.980 回答