jquery menu hovering

前端 未结 5 2018
猫巷女王i
猫巷女王i 2021-01-13 03:24

i have a menu that when i mouse over a div it will show and on mouse out it will fade out. the problem is that if you roll over any of the menu\'s children the menu will dis

5条回答
  •  忘掉有多难
    2021-01-13 04:03

    This is a very simple problem most people tend to massively overcomplicate with timers and special case checks. The easy solution is via markup. Place both hover target and the menu under the same parent, and track hover on the parent. Like this. You may also want to use hoverIntent jQuery plugin to avoid false hover events.

    A UX note: fade animations lasting over 500ms are just rude. Please don't do that.

提交回复
热议问题