html
<body>
<!-- <h1>4月8日武汉解封,一起点亮武汉</h1> -->
<div class="main">
<div id="box1" class="box">
<img src="images/1.jpg" class="pic">
</div>
</div>
<script>
$().ready(function () {
$('img').click(function () {
$(this).addClass('show')
})
})
</script>
</body>
css
#box1 {
background: url('../images/gray-1.jpg') no-repeat;
background-size: 100%;
}
.pic {
width: 200px;
opacity: 0;
transition: all 3s linear;
cursor:pointer;
}
.show {
opacity: 1;
}
效果
点亮武汉