<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<style type="text/css">
#divid {
position:fixed;
z-index:2000;
left:50%;
top:50%;
transform:translate(-50%,-50%);
}
#imgid {
width:1000px;
height:500px;
}
</style>
<!-- <script src="https://ajax.aspnetcdn.com/ajax/jQuery/jquery-3.3.1.js"></script> -->
<script type="text/javascript" src="http://cdn.bootcss.com/jquery/2.1.4/jquery.min.js"></script>
<script >
function myFunction(){
var src=$("#imgip").attr("src")
$("#imgid").attr("src",src)
$("#divid").css("display","block")
}
function myFunc(){
$("#divid").css("display","none")
}
</script>
</head>
<body>
<img id="imgip" onclick="myFunction()" src="http://localhost:8888/11.jpg"/>
<div style="display:none;" id="divid" >
<img onclick="myFunc()" src="" id="imgid" />
</div>
</body>
</html>
原文地址:https://www.cnblogs.com/ayanboke/p/11460824.html