在css

时间:2017-12-18 17:11:25

标签: lightbox2

我正在大学为我的论文实施一个网站,它包括一个画廊。我下载了lightbox2 js文件并使其正常工作。

我的网站也将针对移动屏幕进行优化,并且想知道我将如何使用lightbox2。

1 个答案:

答案 0 :(得分:0)

尝试在文件lightbox.js中替换第306行(适用于v2.10.0):

if (($(window).width() > 300) && ($(window).width() < 993)) {

maxImageWidth  = windowWidth - self.containerPadding.left - self.containerPadding.right - self.imageBorderWidth.left - self.imageBorderWidth.right - your values; 

maxImageHeight = windowHeight - self.containerPadding.top - self.containerPadding.bottom - self.imageBorderWidth.top - self.imageBorderWidth.bottom - your values;

} else {

maxImageWidth  = windowWidth - self.containerPadding.left - self.containerPadding.right - self.imageBorderWidth.left - self.imageBorderWidth.right - 20;

maxImageHeight = windowHeight - self.containerPadding.top - self.containerPadding.bottom - self.imageBorderWidth.top - self.imageBorderWidth.bottom - 120;

}

以下:

if (($(window).width() > 300) && ($(window).width() < 500)) {

maxImageWidth  = windowWidth - self.containerPadding.left - self.containerPadding.right - self.imageBorderWidth.left - self.imageBorderWidth.right - your values;

maxImageHeight = windowHeight - self.containerPadding.top - self.containerPadding.bottom - self.imageBorderWidth.top - self.imageBorderWidth.bottom - your values;

} 

else if (($(window).width() >= 500) && ($(window).width() < 993)) {

maxImageWidth  = windowWidth - self.containerPadding.left - self.containerPadding.right - self.imageBorderWidth.left - self.imageBorderWidth.right - your values;

maxImageHeight = windowHeight - self.containerPadding.top - self.containerPadding.bottom - self.imageBorderWidth.top - self.imageBorderWidth.bottom - your values;

} else {

maxImageWidth  = windowWidth - self.containerPadding.left - self.containerPadding.right - self.imageBorderWidth.left - self.imageBorderWidth.right - 20;

maxImageHeight = windowHeight - self.containerPadding.top - self.containerPadding.bottom - self.imageBorderWidth.top - self.imageBorderWidth.bottom - 120;

}

或者您可以单独设置宽度和高度:

{{1}}

不要忘记设置你的价值。