CSS Suckerfish 和活跃的顶级项目
大脑冻结在这里。
我想要做的是让 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您没有提供太多有关您真正要做的事情的信息。但我的猜测是:你的选择器已关闭。试试这个:
同时从这些项目中删除当前类,并在用户位于正确页面时将其动态添加到适当的项目中。 (也许 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:
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?)