直接贴代码
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title></title>
<style type="text/css">
.on{
transform:scale(0.8,0.8);
}
/*.myimg:hover{
transform:scale(0.8,0.8);
}*/
</style>
<!-- <link rel="stylesheet" type="text/css" href="css/base.css"> -->
</head>
<body>
<img src="img/wf3-big_1f69073.png" class="myimg" style="width:100px;height:100px;transition: all 0.3s linear">
</body>
<script type="text/javascript" src="js/jquery-3.2.1.js"></script>
<script type="text/javascript">
$(".myimg").click(function(){
$(this).addClass("on");
setTimeout(()=>{
$(this).removeClass("on");
},300)
})
</script>
</html>
如果不是点击,是鼠标移入移除触发图片大小改变,直接用纯css就能搞定
.myimg:hover{transform:scale(0.8,0.8)}