相对于 Fancybox 增加车身高度
我使用 Fancybox 在 Intranet 站点上显示复杂的表单。 Fancybox 表单的启动页面使用数据表来过滤和排序数据库中的大量记录。当对列表进行显着过滤并加载 Fancybox 时,Fancybox 内容可能会超出页面正文。这会导致 Fancybox 覆盖不显示的白色区域。
除了丑陋之外,您还无法单击该区域来关闭 Fancybox。
将页面主体增长到至少 Fancybox 高度的最佳方法是什么,使用 CSS、Javascript 或两者兼而有之?
谢谢!
编辑: 以下 Gov 的解决方案是正确的,但没有解决问题。实际上 Fancybox 覆盖层本身的高度需要增加。我现在认为这是 Fancybox 的一个错误。似乎如果主体因 Fancybox 尺寸而增大,则覆盖层应自动增大到主体尺寸。我会将其提交给开发人员。与此同时,如果有人遇到这个问题,我修改过的 Gov 代码将会起作用:
// Adjust Fancybox Overlay Height to Large Fancyboxes
function overlayHeight() {
fancyBoxHeight = $('#fancybox-wrap').height();
finalheight = fancyBoxHeight + 300;
$('#fancybox-overlay').css('height', finalheight);
}
我还想指出,Fancybox 是一个非常出色的插件,所以这不应该被认为是影响任何人反对使用它的原因!
I Use Fancybox to display complex forms on an intranet site. The page the Fancybox forms are launched from uses Datatables to filter filter and sort numerous records from the database. When the list is filtered significantly and the Fancybox is loaded, the Fancybox content can exceed the page body. This results in white area where the Fancybox overlay does not show.
In addition to being ugly, you cannot click in this area to close the Fancybox.
What is the best way to grow my page body to at least the height of the Fancybox, either with CSS, Javascript or both?
Thanks!
EDIT:
Gov's solution below is correct but does not solve the problem. Actually the height of the Fancybox overlay itself needs to be increased. I'm perceiving this now to be a bug with Fancybox. It seems if the body grows as a result of of the Fancybox size, then the overlay should increase to the body size automatically. I will submit this to the developers. In the meantime if anyone has this issue Gov's code as I have modified it will work:
// Adjust Fancybox Overlay Height to Large Fancyboxes
function overlayHeight() {
fancyBoxHeight = $('#fancybox-wrap').height();
finalheight = fancyBoxHeight + 300;
$('#fancybox-overlay').css('height', finalheight);
}
I also want to note that Fancybox is a really great plugin, so this should not be taken to sway from anyone against using it!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我刚刚发现修改CSS是有效的。
I just found that modifying the CSS works.
计算fancybox的高度,假设fancybox id是fancyboxy1,
则需要执行上面的代码,显示fancybox后,它会根据需要设置高度。
Calculate the height of the fancy box , assume fancybox id is fancyboxid1
You need to execute the above code , after you display the fancybox , then it sets the height as required.