Drag the dog and sheep to the drop zone area at the right.</
p>
</div>
<div class="wrap">
<div class="sourcearea">
<span id="itemsheep" class="items"><img src="sheep.jpg"
width="100" class="temp"></span>
<span id="itemdog" class="items"><img src="dog.jpg"
width="100" class="temp"></span>
<span id="Span1" class="items"><img src="sheep.jpg"
width="100" class="temp"></span>
<span id="Span2" class="items"><img src="dog.jpg"
width="100" class="temp"></span>
</div>
<div id="dr1" class="droparea"> </div>
<div id="dr2" class="droparea"> </div>
<div id="dr3" class="droparea"> </div>
<div id="dr4" class="droparea"> </div>
<div id="dr5" class="droparea"> </div>
<div id="dr6" class="droparea"> </div>
</div>
<script>
var itemDogCtr = 0; itemSheepCtr = 0; itemTotalCtr = 0;
$(document).ready(function(){
var drop=false;
$(".items").draggable({helper: 'clone'});
$(".items").droppable({revert: 'valid' });
$(".droparea").droppable({
accept: ".items",
hoverClass: 'dropareahover',
tolerance: 'pointer',
drop: function(ev, ui) {
debugger;
if(itemTotalCtr >= 36) { alert("Area is full"); return;}
var dropElemId = ui.draggable.attr("id");
var dropElem = ui.draggable.html
();
// $(ui.draggable).draggable();
debugger;
if ($(this).find(".temp").length > 0)
{
return;
}
else
{
debugger;
$(this).append(dropElem);
//$(".temp").draggable();
$(this).find(".temp").draggable({helper: 'clone'});
if (drop!=true)
{
drop=true;
$(".sourcearea").droppable({
accept: ".temp",
hoverClass: 'dropareahover',
tolerance: 'pointer',
drop: function(ev, ui) {
debugger;
var ParentID1= $(ui.draggable)[0].parentNode;
$(ParentID1).find(".temp").remove(".temp");
}
});
}
if(dropElemId == 'itemdog') itemDogCtr++;
if(dropElemId == 'itemsheep') itemSheepCtr++;
itemTotalCtr = itemDogCtr + itemSheepCtr;
$("#itemTotal").html(itemTotalCtr.toString());
$("#itemDog").html(itemDogCtr.toString());
$("#itemSheep").html(itemSheepCtr.toString());
}
}
});
});
</script>
</div>
</form>
</body>
</html>