CSS 下拉菜单,可见不起作用

发布于 2024-10-31 11:01:42 字数 664 浏览 1 评论 0原文

编辑:以防万一将来有人发现这一点,我发现解决方案是从使用visibility:更改为display:,所以在代码中

visibiliy:hidden;变为显示:无; 可见的: 可见的;变成显示:块;

还没有确切地知道为什么它的可见性在第四个嵌套上不起作用,但至少这似乎解决了这个问题

嗨,大家好,

我目前正在使用一个使用一些 CSS 和列表创建的下拉菜单。它工作正常,但由于某种原因,该菜单的第四级没有监听visibility:hidden;命令。根据元素检查器,该元素被列为已启用,但实际上并未执行此操作。

示例如下:http://dev.hutchup.com/test/css-dropdown。 htm

我不会过去的代码,因为它太日志了,可以在上面的链接中看到

,您可以看到第一个 2 级链接,当鼠标悬停在显示级别 3 和 4 时,它应该只显示 3,然后当将 3 中的 li 翻过来将显示第 4 级。

我知道有很多更简单的方法可以做到这一点/预建的事情,但我需要这样做,以便我可以使用 joomla 的 ACL 组件并且不显示菜单项。

我花了几个小时但无法修复它,所以提前谢谢你!

EDIT: Just incase anyone in the future finds this i found the solution was to change from using visibility: to display: , so in the code

visibiliy:hidden; becomes display:none;
visibiliy:visible; becomes display:block;

Have not ever found out exactly why it visibility doesn't work on the 4th nesting but atleast this appears to fix it

Hi Guys,

I am currently working with a dropdown menu that is created using some CSS and lists. It is working fine but for some reason the 4th level of this menu is not listening to the visibility:hidden; command. According to element inspector The element is listed as being enabled but it is not actually doing it.

An example is here: http://dev.hutchup.com/test/css-dropdown.htm

I wont past code as it is too log and can be see at the link above

As you can see the first level 2 link when hovered over displays level's 3 and 4 when it should only display 3, and then when an li in 3 is rolled over it will display 4th level.

I know there are many easier ways to do this/ prebuilt thing but i need to do it this way so that i can use the ACL component for joomla and have menu items not display .

Ive spent hours and cant get it fixed so thank you in advance!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

此生挚爱伱 2024-11-07 11:01:42

不确定,但是如此多的嵌套级别是一件可怕的事情,在当今时代,通过一些带有后备功能的简单 JavaScript 可能会更好地处理(特别是如果它是大量嵌套级别),尽管我确实注意到了两件事;

  • 在我看来,您没有为第四级指定任何样式。您可能需要添加一些来看看这是否是您的问题。
  • 你已经有了一些看起来像的 CSS
    像这样 ;

   .moduletable_topmenu ul.menu li.item69 a {
    height: 2.5em;
   }
   */

   /*
   .moduletable_topmenu ul.menu li.item89 {
    height: 3.7em;
   } 

   .moduletable_topmenu ul.menu li.item89 a {
    height: 2.5em;
   }

这些 li.item[n] 项目要么是其他东西留下的,要么是一些未实现的未来想法,但它们肯定不适用于相关菜单。

Not sure, but this many levels of nesting is scary business and in this day and age probably better handled by some simple JavaScript with fallback (especially if it's tons of nested levels), although I did notice two things ;

  • It looks to me that you're not specifying any styles for the fourth level. You may want to add a few to see if that is your problem.
  • You've got some CSS that looks
    like this ;

   .moduletable_topmenu ul.menu li.item69 a {
    height: 2.5em;
   }
   */

   /*
   .moduletable_topmenu ul.menu li.item89 {
    height: 3.7em;
   } 

   .moduletable_topmenu ul.menu li.item89 a {
    height: 2.5em;
   }

These li.item[n] items are either leftover from something else or some future ideas not implemented, but they certainly do not apply to the menu in question.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文