Source code

Revision control

Other Tools

<?xml version="1.0" encoding="utf-8"?>
<head>
<title>Drag and drop of overlapping images: negative margin</title>
<style type="text/css">
span, strong
{color:green;
background-color:yellow;}
strong
{color:red;}
img
{display:block;
width:100px;
height:100px;}
img + img
{margin-top:-100px;}
</style>
<script type="application/ecmascript">
function start(event,feedback)
{event.dataTransfer.effectAllowed = 'copy';
event.dataTransfer.addElement(document.querySelector(feedback));}
</script>
</head>
<body>
<div>
<img ondragstart="start(event,'strong')" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP4z8DwHwAFAAH/VscvDQAAAABJRU5ErkJggg=="/>
<img ondragstart="start(event,'span')" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNgaGD4DwAChAGAJVtEDQAAAABJRU5ErkJggg=="/>
</div>
<p>Try to drag box above. You should see word <span>PASS</span> not <strong>FAIL</strong> in feedback overlay all the time.</p>
</body>
</html>