我遇到了麻烦。 在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 init是:
$(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页面。
提前感谢您的帮助。
答案 0 :(得分:0)
The .pass class in the one that originally
opens the "Change Password" through a link
如果.pass
是链接的类,并假设该链接有自己的href
,那么您只需触发一个click
即可选择器。
所以不是这个
afterClose: function(){
$('.pass').fancybox.open; // this will never work for sure
}
试试这个
afterClose: function(){
$('.pass').trigger("click");
}