1
我有一个内部窗体fancybox。如果表单错误地提交,那么表单上会出现错误,这会导致内容的高度比iframe更大,并且我会得到滚动条。fancybox调整大小 - 如何/何时调用函数
我想要的是调整fancybox如果有错误(div.errors)。
我试过$ .fancybox.resize方法,但似乎没有发生,但有一个很好的机会,我只是做错了。这是我如何调用
$("#login").fancybox({
'width': 682,
'height': 295,
'autoDimensions': true,
'autoScale': true,
'transitionIn': 'fade',
'transitionOut': 'fade',
'type': 'iframe'
});
我已经有点固定它的fancybox自己,但我不喜欢的解决方案,我想至少要得到调整大小的方法工作,看它是否有结果我想。这里是我的代码,以temporaily修复它
function resizeFancybox() {
$('#fancybox-inner', top.document).height(500);
$('#fancybox-wrap', top.document).height(500);
$('iframe#fancybox-frame', top.document).css('height', '95%');
parent.$.fancybox.center();
}
if ($(".secure-login .errors").length){
resizeFancybox();
}
感谢所有