layui可以使图片点击放大,不用在写jquyery了真是很方便。
操作示例
引入
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/layui-layer@3.1.1/dist/layui.css" />
<script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/layui-layer@3.1.1/dist/layui.js"></script>
//创建容器
<div id="warranty_image">
@@##@@
</div>
<script>
layui.use(['form', 'table'], function () {
var $ = layui.jquery,
form = layui.form,
table = layui.table;
$("#warranty_image").click(function () {
layer.photos({
photos: {
data: [
{
src: $(this).attr("src")
}
]
},
shade: 0.7
});
})
});
</script>