CSS Suckerfish 和活跃的顶级项目

发布于 2024-08-03 17:48:49 字数 1118 浏览 0 评论 0原文

大脑冻结在这里。

我想要做的是让 Suckerfish 下拉菜单链接在下拉列表中的当前页面以及顶部项目上处于活动状态。

即,在下面的“文章”菜单项中,我希望在“类别一”或“类别二”处于活动状态的同时使顶部项目“文章”处于活动状态。 (档案是一个单级菜单项,仅供参考。)

我设置了 php 来生成带有页面标题的 body 标记,因此页面 Categoryone 的 body 标记是

HTML:

<ul class="sf-menu">

<li id="Archives-menu" class="current"><a href="http://mydomain.com/archives/" title="Archives">Archives</a></li>

<li id="Articles"><a href="" title="Articles">Articles</a><ul>

<li id="Categoryone-menu" class="current"><a href="http://mydomain.com/categoryone/" title="Categoryone">Categoryone</a></li>
<li id="Categorytwo-menu" class="current"><a href="http://mydomain.com/categorytwo/" title="Categorytwo">Categorytwo</a></li></ul></li>

</ul>

CSS:

#Archives #Archives-menu a, #Categoryone-menu #Categoryone-menu a, #Categorytwo-menu #Categorytwo-menu a

{
color:#fff;
}

如果我将其放入 #Articles #Articles-menu a 中尝试使文章处于活动状态,则下拉列表中的所有链接都会处于活动状态。

Brain freeze here.

What I want to do is have the Suckerfish drop down menu link to be active on the current page in the drop down as well as the top item.

I.e. below, in the Articles menu item, I'd like to have the top item "Articles" active at the same time that either Categoryone or Categorytwo is active. (Archives is a single level menu item, included here just FYI.)

I have php set up to generate a body tag with the title of the page, so the body tag for the page Categoryone is <body id="Categoryone">

HTML:

<ul class="sf-menu">

<li id="Archives-menu" class="current"><a href="http://mydomain.com/archives/" title="Archives">Archives</a></li>

<li id="Articles"><a href="" title="Articles">Articles</a><ul>

<li id="Categoryone-menu" class="current"><a href="http://mydomain.com/categoryone/" title="Categoryone">Categoryone</a></li>
<li id="Categorytwo-menu" class="current"><a href="http://mydomain.com/categorytwo/" title="Categorytwo">Categorytwo</a></li></ul></li>

</ul>

CSS:

#Archives #Archives-menu a, #Categoryone-menu #Categoryone-menu a, #Categorytwo-menu #Categorytwo-menu a

{
color:#fff;
}

If I throw this in #Articles #Articles-menu a to try and make Articles active, then all the links in the drop down are active.

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

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

发布评论

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

评论(1

海风掠过北极光 2024-08-10 17:48:49

您没有提供太多有关您真正要做的事情的信息。但我的猜测是:你的选择器已关闭。试试这个:

#Archives a , #Archives-menu a , .current
{
color:#fff;
}

同时从这些项目中删除当前类,并在用户位于正确页面时将其动态添加到适当的项目中。 (也许 Sukerfish 会为你做到这一点?)

You have not given much info about that you are truing to do. But here is my guess: Your selector is off. Try this:

#Archives a , #Archives-menu a , .current
{
color:#fff;
}

Also remove the current class from those items and add it to the appropriate item dynamically when the user is on the right page. (Maybe Sukerfish does that for you?)

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