[英]SimpleLightbox jQuery Plug-In offer re-size of image?
jQuery顯然會調整圖像的大小,如果圖像大2以適合燈箱。
(如此處所示 )。
但是,這對我而言不會發生,因為當我查看大圖像時,它會占據整個頁面,並且您必須滾動才能看到該圖像。
在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。
它必須工作。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.