You need to create a mouseover event on the block, but this event also works on all children of this node, how can you ignore all children that are inside the block. dug in the direction of stopPropagation (), but did not find the necessary implementation.

 <div id="test"> <div class="child"></div> <div class="child"></div> </div> document.getElementById('test').addEventListener('mouseover',function(){ // какая Ρ‚ΠΎ Π»ΠΎΠ³ΠΈΠΊΠ° },false); 

And in this case, mouseout works when you hover on the child class.

    1 answer 1

     document.getElementById('test').addEventListener('mouseover',function(e){ if(e.target.id == "test"){ // какая Ρ‚ΠΎ Π»ΠΎΠ³ΠΈΠΊΠ° } },false); 
    • if(e.target.id != "test"){return;} - why turn everything in if - Vlad Vlad
    • maybe children will need it right there and work with them a little - Artsiom
    • ok, target.id! = 'test', falls on child and the event is triggered - ddeadlink
    • sorry
    • dug that mouseenter ignores children, is also an option - ddeadlink