相对于 Fancybox 增加车身高度

发布于 2024-10-01 16:28:39 字数 749 浏览 2 评论 0原文

我使用 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

隔纱相望 2024-10-08 16:28:39

我刚刚发现修改CSS是有效的。

#fancybox-overlay {
    position: fixed; //I just changed the position to fixed, and voila
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1100;
    display: none;

I just found that modifying the CSS works.

#fancybox-overlay {
    position: fixed; //I just changed the position to fixed, and voila
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1100;
    display: none;
眼波传意 2024-10-08 16:28:39

计算fancybox的高度,假设fancybox id是fancyboxy1,

fancyBoxHeight=$('#fancyboxid').height(); 

// determine how much width you want//

finalheight=fancyBoxHeight+300 or 400

 $('body').css('height', finalheight);

则需要执行上面的代码,显示fancybox后,它会根据需要设置高度。

Calculate the height of the fancy box , assume fancybox id is fancyboxid1

fancyBoxHeight=$('#fancyboxid').height(); 

// determine how much width you want//

finalheight=fancyBoxHeight+300 or 400

 $('body').css('height', finalheight);

You need to execute the above code , after you display the fancybox , then it sets the height as required.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文