私はお互いの近くにいくつかのボタンを持っています。彼らの上にホバリングすると、子供が飛び出し、ホバーをするとその効果はなくなります。event.stopPropagation()does not work
問題はcss(:ホバー)です。不安定な状態を防ぐことはできません。私はmouseenterとmouseleaveを使い、stopPropagation関数を使用して、子トリガー親eventListenerで不要なホバーが起きたときの不安定な状態を防ぎます。
それdoesntの仕事、私は他の回答をチェックするが、イベントを忘れる>>ここに私の問題
での私の仕事 完全なコードのリンクが何であるかをhttps://jsfiddle.net/fe3m74xn/
var el = document.querySelectorAll('#slideShow_control a');
var slideShow_control_hoverIn = function(e, i) {
e.stopPropagation();
var bool = e.target.classList.contains('hover');
el.forEach.call(el, function(e){e.classList.remove('hover')});
if(!bool) {
e.target.classList.toggle('hover');
}
};
var slideShow_control_hoverOut = function(e, i) {
e.stopPropagation();
el.forEach.call(el, function(e){e.classList.remove('hover')});
};
el.forEach.call(el,function(e){e.addEventListener('mouseenter',slideShow_control_hoverIn,false)});
el.forEach.call(el,function(e){e.addEventListener('mouseleave',slideShow_control_hoverOut,false)});
うんは魔法のように動作し、おかげで –