第一次打开时,Colorbox不能以适当的高度打开 [英] Colorbox doesn't open at proper height when first opened

查看:64
本文介绍了第一次打开时,Colorbox不能以适当的高度打开的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

因此,我将 colorbox 插件用于联系表格.我只是默认的颜色盒属性,因此它应该自动调整为包含的div(对吗?).

So I'm using the colorbox plugin for a contact form. I am just the default colorbox properties, so it should automatically adjust to the div it contains (right?).

当第一次加载此颜色框内容时,该颜色框内容上会有一个小的垂直滚动条.我已经看到它偶尔出现在Firefoxchrome中,对于OSX

Well There is a small vertical scroll bar on this colorbox content when its FIRST loaded. I've seen it happen sporadically in Firefox and chrome for OSX

$("a.modalAutosize").each(function(){
    $(this).colorbox();

});

示例中的有效代码

$("a.modalAutosize").each(function(){
    $(this).colorbox({onOpen: function(){$.fn.colorbox.resize()}});

});

推荐答案

我已经研究了这个问题.

I've investigated the problem.

尝试查看您通过ajax加载哪些内容.如果它的某些图像没有高度"和宽度"属性,则会显示滚动条.

Try to see which content you load by ajax. If it has some images without "height" and "width" attributes, the scroll bars can appear.

之所以发生这种情况,是因为浏览器不知道图像的大小,并且不等到加载后才计算页面布局.第一次加载后,图像就在缓存中,浏览器可以计算出大小.

It happens because the browser does not know about the image's size and doesn't wait until it loads to calculate the page layout. After the first load the image is in the cache and the browser can calculate the size.

尝试为您的图像指定尺寸.对我来说有效.

Try to specify the size for you images. For me it works.

这篇关于第一次打开时,Colorbox不能以适当的高度打开的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆