layui 点击放大图片
程序员文章站
2022-05-13 23:51:05
...
html
<div class="layui-input-block">
<img class="radius50" src="{$list.identity}" style='width:100px;height:100px;padding:1px;border:1px solid #ccc' />
</div>
js:
layui.use(['jquery', 'layer', 'form'], function () {
$ = layui.$;
var form = layui.form;
var layer = layui.layer;
$('.radius50').click(function () {
console.log($(this).attr('src'))
var imgSrc = $(this).attr('src')
layer.open({
type: 1,
title: false,
area:["800px","600px"], //弹出框大小
closeBtn: 0,
skin: 'layui-layer-nobg',
shadeClose: true,
content: '<img class="radius50" src="'+imgSrc+'" style="width:800px;height:600px;#ccc" />',
scrollbar: false
})
})