get rid of horizontal scrollbars for fit width
This commit is contained in:
parent
292c3e1e6c
commit
c68b76721c
@ -429,14 +429,17 @@ imageResize = (cw, ch, imageType, image) ->
|
||||
|
||||
switch imageType
|
||||
when 'full'
|
||||
image.removeAttribute 'width'
|
||||
image.removeAttribute 'style'
|
||||
return
|
||||
when 'fit width'
|
||||
ratio = cw/iw
|
||||
if iw > cw
|
||||
image.style.width = '100%'
|
||||
image.style.margin = '0px'
|
||||
when 'fit screen'
|
||||
ratio = Math.min cw/iw, ch/ih
|
||||
if ratio < 1
|
||||
image.width = Math.floor ratio * iw
|
||||
if ratio < 1
|
||||
image.style.width = Math.floor ratio * iw
|
||||
image.style.margin = '0px'
|
||||
|
||||
imageThumb = (thumb) ->
|
||||
thumb.className = ''
|
||||
|
||||
15
4chan_x.js
15
4chan_x.js
@ -615,16 +615,19 @@
|
||||
ih = Number(ih);
|
||||
switch (imageType) {
|
||||
case 'full':
|
||||
image.removeAttribute('width');
|
||||
image.removeAttribute('style');
|
||||
return;
|
||||
case 'fit width':
|
||||
ratio = cw / iw;
|
||||
break;
|
||||
if (iw > cw) {
|
||||
image.style.width = '100%';
|
||||
return image.style.margin = '0px';
|
||||
}
|
||||
case 'fit screen':
|
||||
ratio = Math.min(cw / iw, ch / ih);
|
||||
}
|
||||
if (ratio < 1) {
|
||||
return image.width = Math.floor(ratio * iw);
|
||||
if (ratio < 1) {
|
||||
image.style.width = Math.floor(ratio * iw);
|
||||
return image.style.margin = '0px';
|
||||
}
|
||||
}
|
||||
};
|
||||
imageThumb = function(thumb) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user