需求
图片点击后,宽度满屏
问题
viewer.js 在预览图片时,默认是0.9的倍数
修改viewer.js
initImage: function initImage(done) {
...
sizingImage = getImageNaturalSizes(image, function (naturalWidth, naturalHeight) {
var aspectRatio = naturalWidth / naturalHeight;
var width = viewerWidth;
var height = viewerHeight;
_this2.imageInitializing = false;
if (viewerHeight * aspectRatio > viewerWidth) {
height = viewerWidth / aspectRatio;
} else {
width = viewerHeight * aspectRatio;
}
width = Math.min(width * 0.9, naturalWidth); //这里的0.9 改为1 即可
height = Math.min(height * 0.9, naturalHeight); //这里的0.9 改为1 即可