Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
166
rated 0 times [  169] [ 3]  / answers: 1 / hits: 24591  / 8 Years ago, thu, september 29, 2016, 12:00:00

I have a span child in a div.



On my div I have a mouseover event, when I hover on the span, my event triggers.



Simple code:



<div (mouseover)=showOverlay($event, FooBar) (mouseleave)=showOverlay($event, FooBar)>
<span>{{ someDataHere }}</span>
</div>


public showOverlay($event, op, element): void {
op.toggle($event, element);
$event.preventDefault();
}


What I want is to keep showing my overlay when on child, how do I achieve this?


More From » angular

 Answers
27

mouseenter and mouseleave cover this use case better because entering a child doesn't mouseleave to fire, only leaving the outside border of the actual element makes it to fire.



See also What is the difference between the mouseover and mouseenter events?


[#60557] Tuesday, September 27, 2016, 8 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
elaine

Total Points: 628
Total Questions: 111
Total Answers: 104

Location: Marshall Islands
Member since Tue, Sep 21, 2021
3 Years ago
;