简体   繁体   English

与桌面上的Mega导航进行交互时,会触发Mouseleave事件

[英]Mouseleave event is fired when interacting with Mega navigation on desktop

I have been having an issue where if I hover over blinds and then click between type, room, colour etc, the nav randomly closes itself. 我遇到一个问题,如果我将鼠标悬停在百叶窗上,然后在类型,房间,颜色等之间单击,则导航会自动关闭。

I know why it is closing itself and thats because the .site-navigation element has a mouseleave event bound to it to close the mega nav when the mouse has left the component. 我知道为什么它会自行关闭,这是因为.site-navigation元素具有绑定到它的mouseleave事件,以在鼠标离开组件时关闭超级导航。

elSiteNav.addEventListener('mouseleave', handleSiteNavMouseEvent);

It is very tricky to replicate but once its replicated the issue happens frequently. 复制非常棘手,但是一旦复制,该问题就会经常发生。

url: https://www.hillarys.co.uk/ 网址: https//www.hillarys.co.uk/
browser: chrome 浏览器:chrome

Use stopPropagation in the handleSiteNavMouseEvent function 在handleSiteNavMouseEvent函数中使用stopPropagation

handleSiteNavMouseEvent(event){
event.stopPropagation();
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM