M
M
Mr_Boombastic2014-12-19 09:39:23
JavaScript
Mr_Boombastic, 2014-12-19 09:39:23

Why doesn't mouseout style change work when moving from parent node to child node?

Good afternoon!
The element has mouseover/mouseout handlers that change the color of the element when the cursor is hovered over.
Following the logic described here and here , the color change should also occur when the cursor moves from the parent node to the child.
For some reason my script is not working as expected. FF 34.05, Chrome 39 and Safari 7.1.2 only change color when the cursor is completely outside of the element.
View code on fiddle

Answer the question

In order to leave comments, you need to log in

4 answer(s)
S
Sergey Melnikov, 2014-12-19
@Mr_Boombastic

Because when moving from the parent node to the child node, there is no mouseout, the mouse is still over the parent element. But you can disable the propagation of the event, and then everything will be ok
jsfiddle.net/zv044qaL/4

P
Pavel Elizariev, 2014-12-19
@effetto

To change the style of an element, use the css :hover pseudo-class. Mouse events are not designed for such tasks. I myself encountered a situation where the mouseout code does not work correctly. Updating the browser solved this problem, but you can't expect all users to have modern browsers.

S
Sergey Sokolov, 2017-05-01
@Gagatyn

I didn’t have discrete mathematics, but I would solve it this way. There are statements:

Л: Пс Бд
П: Лс Бд
Б: Лс Пе

Let's find a couple of statements from which one ripped off both times, the other told the truth both times. Since the statements Л-Пare connected through Бд, and П-Бthrough Лс, a pair remains Л-Б- one of them is true both times, the other is false both times.
I will designate a false statement with exclamation. sign (logical NOT) - for example, !Лс.
So, once he lied and one told the truth, it turns out, Donut: П: !Лс Бд
In order for it to Лсbe false, B’s statements must also be made false. So, B lied both times, and L told the truth both times:
Л: Пс Бд
П: !Лс Бд
Б: !Лс !Пе

Total, we know for sure: Ps and Bd. Le remains.
Lenchik - spruce; Donut - pine; Bar - oak.
upd. Is this how the truth table is made?
Л П Б  Пс Бд  Лс Бд  Лс Пе
0 1 2  0  0   1  1   0  1  конфликт Бд и Лс
0 2 1  0  0   0  1   1  1  конфликт Бд и Лс  
1 0 2  1  1   0  0   0  1  конфликт Бд
2 0 1  0  1   0  0   1  1  конфликт Бд и Лс
1 2 0  1  1   0  1   0  0  ОК
2 1 0  0  1   1  1   0  0  конфликт Лс

Variables three: the truth of each character's statements. Three possible states: 0 - lied both times, 1 - true both times, 2 - lied-true. Then we reveal their meaning for each of the statements (0 false, 1 true). In all cases, except for one, there are logical conflicts.

K
kstyle, 2017-05-01
@kstyle

something like a truth table, apparently, needs to be compiled

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question