Mega Menu Issues [closed]

走远了吗. 提交于 2019-12-13 23:37:10

问题


I have a mega menu I've been having two issues with.

  1. I can't seem to keep the hover state active when I'm hovering over each section.
  2. The header tags that trigger the mega menu seem to have a width of the container that they are in. This causes the mega menu to pop up even if you don't rollover it visually.

I posted my current code for the mega menu here: http://www.boyga.com/mega-menu/

I'm using the hoverintent plug-in.


回答1:


Issue #2 is easy to fix. Add this CSS rule to your stylesheet:

ul#Top-Nav {
    display: inline-block;
}

Issue #1 is almost as simple. It's more CSS changes. Because your submenu descents from the <li> but not the <a>, you need to change your CSS rules that involve a:hover and a:active:

    ul#Top-Nav li:hover a{color:#1E90FF;text-decoration:none;}
    ul#Top-Nav li:hover a{background:#1E90FF url(arrow.png) no-repeat right center;color:#fff;}
    ul#Top-Nav li:active a{background:#1E90FF url(arrow.png) no-repeat right center;color:#fff;}

This works for me, at least on Chrome. You may (read: probably) will have issues on other browsers, where the :hover and :active pseudo-classes don't bubble up.



来源:https://stackoverflow.com/questions/4674834/mega-menu-issues

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!