JSFiddle - React, Tailwind, and code Playground
HTML
<img src="http://www.theholidayspot.com/christmas/img/mistletoe.png" style="
f;
f;
position: absolute;
left: 139px;
">
<img style="-webkit-user-select: none; position: absolute; margin-top: 300px; cursor: zoom-out;" src="http://static4.wikia.nocookie.net/__cb20131214014250/kill-la-kill/images/f/f0/Op_satsuki.jpg" width="632" height="754" class="satsuki">
CSS
.heart{
width:200px;
position: absolute;
z-index:100;
}
.satsuki{
width:300px;
left:200px;
height:auto;
}
JavaScript
$(document).ready(function(){
var hearts = Array();
function getRand(){
return Math.floor((Math.random() * 500) + 1);
}
function checkIfRand(rand){
if(hearts.indexOf(rand)){
return rand;
}else{
checkIfRand(rand);
}
}
function getX(){
return Math.floor((Math.random() * 500) + 1);
}
function getY(){
return Math.floor((Math.random() * 500) + 1);
}
function love(){
var rand = checkIfRand(getRand());
$('body').append("<img src='http://www.clker.com/cliparts/B/Y/a/U/z/y/love-heart-hi.png' id='" + rand + "' class='heart'>");
$("img#" + rand).css("left", getX());
$("img#" + rand).css("top", getY());
hearts.push(rand);
}
function removeHeart(){
if(hearts.length > 5){
var id = hearts.shift();
console.log(hearts.length);
$("img#" + id).remove();
}
}
setInterval(function(){
love();
setTimeout(function() {
removeHeart();
}, 100);
}, 1000);
});