function previewImg(src) {
var img = new Image();
img.src = src;
var height = img.height * 1; //获取图片高度
var width = img.width * 1; //获取图片宽度
if(height>392){
height=392;
}
if(width>619){
height=619;
}
var imgHtml = "<img src='" + src + "' />";
//弹出层
layer.open({
type: 1,
shade: 0.8,
offset: 'auto',
area: [width + 'px', height + 'px'],
shadeClose: true,//点击外围关闭弹窗
scrollbar: false,//不现实滚动条
title: "", //不显示标题
content: imgHtml, //捕获的元素,注意:最好该指定的元素要存放在body最外层,否则可能被其它的相对元素所影响
cancel: function () {
//layer.msg('捕获就是从页面已经存在的元素上,包裹layer的结构', { time: 5000, icon: 6 });
}
});
return false;
}

相关文章:

  • 2022-01-31
  • 2022-12-23
  • 2022-12-23
  • 2021-07-09
  • 2021-12-13
  • 2022-12-23
  • 2021-05-04
猜你喜欢
  • 2021-11-02
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2020-02-14
相关资源
相似解决方案