0

我遇到了一些问题。在 fancybox 窗口中更改密码后,我正确打开了“错误密码”Iframe(如果用户输入错误密码)。问题来了:关闭“错误密码”Iframe 后,我想重新打开“密码更改”Iframe。在检查密码有效性后的“错误密码”iframe上,我使用:

<link rel="stylesheet" href="/includes/fancybox/source/jquery.fancybox.css?v=2.1.5" type="text/css" media="screen" />
<script type="text/javascript" src="/includes/fancybox/source/jquery.fancybox.pack.js?v=2.1.5"></script>


    <script type="text/javascript">
    parent.$.fancybox.open([
        {
            href: '/pages/messages/wrong_password.asp'
        },
    ], {
        maxWidth: 350,
        maxHeight: 65,
        fitToView: false,
        width: 350,
        height: 65,
        padding: 0,
        scrolling: 'auto',
        preload: true,
        type: 'iframe',
        closeBtn: false,
        openEffect: 'elastic',
        closeEffect: 'fade',
        helpers: {
            overlay: {
                css: {
                    'background': 'rgba(255,255,255, 0.80)'
                }
            }
        },
        afterClose: function () {
            $('.pass').fancybox.open;
        }
    });
</script>

我的fancybox初始化是:

$(document).ready(function () {

    $('.fancybox').fancybox({
        openEffect: 'elastic',
        fitToView: true,
        closeEffect: 'fade',
        padding: 5,
        helpers: {
            overlay: {
                css: {
                    'background': 'rgba(227,227,227, 0.90)'
                }
            }
        }
    });


    $('.pass').fancybox({
        maxWidth: 560,
        maxHeight: 300,
        fitToView: false,
        type: 'iframe',
        width: 560,
        padding: 0,
        height: 300,
        autoSize: true,
        autoResize: true,
        autoScale: true,
        closeClick: false,
        closeBtn: false,
        openEffect: 'fade',
        openSpeed: 'fast',
        closeEffect: 'fade',
        closeSpeed: 'fast',
        scrolling: 'auto',
        helpers: {
            overlay: {
                css: {
                    'background': 'rgba(227,227,227, 0.90)'
                }
            }
        }
    });
});    

最初通过链接打开“更改密码”的类中的 .pass 类,但我无法再次传递 href 页面。

预先感谢您的任何帮助。

4

1 回答 1

0
The .pass class in the one that originally 
opens the "Change Password" through a link

if.pass是链接的,并假设链接有自己的,href那么您只需要click在该选择器上触发 a 。

所以代替这个

afterClose: function(){
    $('.pass').fancybox.open; // this will never work for sure
}

尝试这个

afterClose: function(){
    $('.pass').trigger("click");
}
于 2013-11-01T07:31:24.133 回答