Skip to content
Advertisement

Mega menu div hides on hover | reactjs

I am creating a mega menu in reactjs framework for my ecommerce website. When ever i hover on list item it shows mega menu div but when i move cursor down the menu hides itself. Why it is not stay as it is ?

Local state which controls the menu display state on onMouseEnter and onMouseLeave works well.

JavaScript
JavaScript

Advertisement

Answer

Because you placed the function on “a” element, when you leave that element, the onMouseLeave function runs.

you should put those functions on the “mega-drop-down” element

also if u know CSS you can make it very simply

JavaScript
JavaScript
User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement