我可以在 YUI 菜单中创建一个不是菜单项的项目吗

发布于 2024-07-14 23:32:17 字数 737 浏览 7 评论 0原文

我有一个基于 YUI 菜单 顶栏导航菜单/developer.yahoo.com/yui/examples/menu/topnavfrommarkup_source.html" rel="nofollow noreferrer">此示例。

我希望能够向其中插入充当标题而不是菜单项的项目。 例如,我可能有一个不同类别的产品列表,并且我想要每个类别都有一个类别标题。 我不需要子菜单 - 我想要菜单内的标题。

我希望它像这样做一样简单:(

 <li class="menuHeading">Heading</li>

并且显然定义了 menuHeading 样式)。

这实际上是有效的 - 只要该项目出现在菜单中的正确位置即可。 但它的行为就像一个菜单项(当我将其鼠标悬停时,它会以蓝色突出显示)。 我检查了 Chrome 中的 DOM,发现 YUI 菜单 javascript 实际上添加了以下类 'yuimenuitem' 并为其提供了生成的 ID。

有没有一种“官方”的方法来做我想做的事情,或者我必须诉诸一些黑客,我想只是将 menuHeading 类更改为当我将鼠标悬停在它上面时具有白色背景,但是如果没有必要,我宁愿不这样做。

I have a YUI menu top bar navigation menu based from this example.

I'd like to be able to insert items to it that serve as captions and not menu items. For instance I may have a list of products in different categories, and I want a category heading for each. I don't want submenus - I want headings WITHIN the menu.

I was hoping it was as simple as doing this :

 <li class="menuHeading">Heading</li>

(and obviously defining the menuHeading style).

This actually works - insomuch as the item appears in the menu in the correct position. But it behaves as a menu item (highlights in blue when I rollover it). I inspected the DOM in Chrome and it appears that the YUI menu javascript is actually adding the following class 'yuimenuitem' and giving it a generated ID.

Is there an 'official' way to do what I want or do I have to resort to some hack, I'm thinking just changing the menuHeading class to have a white background when I hover over it, but I'd rather not do that if I don't have to.

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

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

发布评论

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

评论(1

给不了的爱 2024-07-21 23:32:17

YUI 菜单支持内置标题 - 它们称为组标题。 有两个 YUI 菜单示例说明了如何为组添加标题:

http://developer .yahoo.com/yui/examples/menu/example05.html
http://developer.yahoo.com/yui/examples/menu/example06。 html

YUI Menu has support for headings built in - they're called group titles. There are two YUI Menu examples that illustrate how to title groups:

http://developer.yahoo.com/yui/examples/menu/example05.html
http://developer.yahoo.com/yui/examples/menu/example06.html

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