dimanche 29 mars 2015

On Drop target enter and leave custom event

I have one drop target div which have some nested div's, i add dragover event to parent div and add 'drag-allow' attrib to nested divs. I want to add custom event fires when mouse enters or leave any child div.



<div id="container">
<div id="page1" drag-allow >
Page #1
</div>
<div id="page2" drag-allow>
Page #2
</div>
<div id="page3" drag-allow>
Page #3
</div>



var ground = document.getElementById('container');
...
ground.addEventListener('dragover', function(e){
evt.preventDefault();
evt.stopPropagation();

evt.target.id; // custom event will fire based on child div's id

}, false);

Aucun commentaire:

Enregistrer un commentaire