GIF图

代码块
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<style>
*{
margin: 0;
}
.iBg{
width:100%;
height: 780px;
position:absolute;
top:0px;
left:0px;
background: url("images/1.jpg");
}
img{
position:absolute;
top:85px;
left:195px;
}
#seed{
background-image:url(images/btn_seed.png);
width:56px;
height:56px;
position:absolute;
top:695px;
left:250px;
cursor:hand;
}
#grow{
background-image:url(images/btn_grow.png);
width:56px;
height:56px;
position:absolute;
top:695px;
left:350px;
cursor:hand;
}
#bloom{
background-image:url(images/btn_bloom.png);
width:56px;
height:56px;
position:absolute;
top:695px;
left:450px;
cursor:hand;
}
#fruit{
background-image:url(images/btn_fruit.png);
width:56px;
height:56px;
position:absolute;
top:695px;
left:550px;
cursor:hand;
}
.border{
border: 5px solid coral;
border-radius: 30px;
}
</style>
<body>
<div id="bg" class="iBg" ></div>
<span id="seed"></span>
<span id="grow"></span>
<span id="bloom"></span>
<span id="fruit"></span>
</body>
<script src="https://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js"></script>
<script>
var img ;
$(document).ready(function(){
$('#bg').on('click',function () {
console.log('Y:'+event.clientY+'X:'+event.clientX);
})
function f(){
$('#bg').off();
$("#bg").on("click",function(e){
if(e.clientX>84&&e.clientX<1469&&e.clientY>262&&e.clientY<724){
$("<img src='images/"+img+"'/>").prependTo("#bg").css("top",e.clientY-40).css("left",e.clientX-50).on('click',function () {
$(this).remove();
});
}else{
$('#bg').off();
}
});
}
$("#seed").on("click",function(){
$('span').removeClass('border');
$(this).addClass('border');
img = "seed.png";
f();
});
$("#grow").on("click",function(){
$('span').removeClass('border');
$(this).addClass('border');
img = "grow.png";
f();
});
$("#bloom").on("click",function(){
$('span').removeClass('border');
$(this).addClass('border');
img = "bloom.png";
f();
});
$("#fruit").on("click",function(){
$('span').removeClass('border');
$(this).addClass('border');
img = "fruit.png";
f();
});
});
</script>