asp.net - SimpleLightbox jQuery 插件提供重新调整图像大小?

标签 asp.net jquery html css jquery-plugins

如果图像是 2 大以正确适合灯箱,jQuery 显然会重新调整图像的大小。

(As seen here)。

但这对我来说并没有发生,因为当我查看大图像时,它会占据整个页面,您必须滚动才能看到图像。

我是否缺少可以在 jquery 文件或 CSS 中设置图像的最大宽度和高度的地方?

提前致谢!

最佳答案

原则上,你不应该有这个问题。

试试看你有没有这些线(1405线等等):

http://github.com/balupton/jquery-lightbox/blob/master/scripts/jquery.lightbox.js

 if ( this.auto_resize !== false )
{ // We want to auto resize
var maxWidth = Math.floor(wWidth*(4/5));
var maxHeight = Math.floor(wHeight*(4/5));
var resizeRatio;
while ( iWidth > maxWidth || iHeight > maxHeight )
{ // We need to resize
if ( iWidth > maxWidth )
{ // Resize width, then height proportionally
resizeRatio = maxWidth/iWidth;
iWidth = maxWidth;
iHeight = Math.floor(iHeight*resizeRatio);
}
if ( iHeight > maxHeight )
{ // Resize height, then width proportionally
resizeRatio = maxHeight/iHeight;
iHeight = maxHeight;
iWidth = Math.floor(iWidth*resizeRatio);
}
}
}

这里有 iWidth,它是图像宽度和 maxWidth,它是屏幕的宽度。

如果iWidth更大,则等于maxWidth。

它必须有效。

关于asp.net - SimpleLightbox jQuery 插件提供重新调整图像大小?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3922668/

相关文章:

javascript - 跟踪滚动事件的页码

asp.net - Jquery 在页面加载时从列表中获取选定的单选按钮

javascript - jquery ajax 请求没有响应

c# - ASP.Net MVC 4 EditorFor DateTime 未在 Chrome 中预填充

jquery - 在 Asp.net MVC View 中,如何使用 jQuery 解析刚刚从 Controller 返回的 XML

javascript - Twitter Bootstrap 使用 "Collapse"插件扩展文本

javascript - 我们如何在多个选项卡(页面)中使用相同的状态?

jquery - 将一个 div 放入另一个 div 中,用一条线将两者连接起来

javascript - 如何使用 jquery 选择的插件在悬停/鼠标悬停事件上获取选择的选项值?

css - 更改透明div中文本的颜色