我使用lightbox 2来放大显示图片,有些图片尺寸比浏览器窗口尺寸大,很难看清,那么如何将lightbox图像框尺寸固定为默认值?
最佳答案
也许你可以使用CSS。像这样的东西:
#lightbox #imageContainer img {
max-width: 600px;
}
/*********************************************
*
* NOTE: "max-width" is not supported by IE6.
* If al your images are bigger than
* the "default", just use "width".
*
*********************************************/
我建议使用另一个灯箱库。我最喜欢的是Colorbox ,它实际上有一个名为 scalePhotos
的选项,根据他们的描述:
If true, and if maxWidth, maxHeight, innerWidth, innerHeight, width, or height have been defined, ColorBox will scale photos to fit within the those values.
此选项默认为true
。
关于javascript - 如何修复灯箱图像尺寸?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8623135/