monstrorosso,
строки 139 -150, заменить на это
elem1.addEventListener("dragstart",function(event) {
offset1X = event.pageX;
offset1Y = event.pageY;
});
elem1.addEventListener("dragend",function(event){
elem1.style.top = (parseFloat(elem1.style.top||10) + event.pageY-offset1Y)+"px";
elem1.style.left = (parseFloat(elem1.style.left||10) + event.pageX-offset1X)+"px";
console.log(event.pageX, event.pageY);
});