javascript - 如何修复灯箱图像尺寸?

标签 javascript lightbox lightbox2

我使用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/

相关文章:

javascript - 在 JS 中从一个方法调用另一个方法

javascript - lightbox2 不安全数据图像

javascript - AngularJS 指令未获取范围内传递的数据

javascript - 在 chrome 中使用 css 分页符属性进行打印的解决方法?

javascript - LightBox Jquery 的问题

jquery - 让灯箱出现在 iframe 之外?

jquery - Lightbox2:CSS 设置为显示:无

javascript - 触发 Lightbox onLoad w/Delay

javascript - 在javascript中验证多个控件

javascript - 单击背景时禁用关闭弹出窗口