img查看大图时图片变形

layui.use('layer', function () {
var layer = layui.layer;
var img = new Image();
img.src = imgUrl;
var content = '<div style="text-align:center;overflow: hidden;width:' + img.width + 'px;height:' + img.height+ 'px"><img style="max-width:100%;max-height:100%;left:0;top:0;right:0;bottom:0;margin:auto" src="' + imgUrl + '"/></div>';

layer.open({
title: false,
type: 1,
offset: 'auto',
btn: false,
closeBtn: false,
area: [w + 'px', h + 'px'],
content: content,
success: function (e, i) {
e.dblclick(function () {
layer.close(i);
});
}
});
});

posted @ 2019-09-29 14:28  艺洁  阅读(468)  评论(0编辑  收藏  举报