我的主菜单有问题。当您单击“按主题分类的案例”菜单项时,您将被带到“按主题分类的案例”页面。然后,“按主题分类的案例”菜单项被赋予css类"active“。我将其设置为,如果菜单项具有“活动”css,则它是深蓝色,而不是浅蓝色,以表示它是当前菜单项。
它自己的页面有一个drupal块,其中有许多分类法菜单项。这些分类菜单项中的每一个都指向此页面,但将在页面中加载不同的信息集(这是一个drupal视图)。
当他们单击块中的分类法链接时,它会重新加载页面,但是“按主题分类”主菜单项不再有“活动”css类。
下面是一个图片示例:
用户点击“案例按主题”主菜单项和页面加载。此时“按主题分类的案例”菜单项具有'active‘css类。然后,用户单击drupal块中的分类法链接(“访问信息”)。
相同的页面重新加载,但是现在“活动”css位于分类法链接上,而不是主菜单“按主题分类的情况”菜单项。
我真的希望“活动”css类能够停留在“按主题分类的情况”主菜单项上,即使人们单击分类法块中的链接时也是如此。
至少,我不会让刚刚单击的分类法链接具有“活动”css,并且“按主题分类”应该保留css类。
有什么想法吗?
发布于 2014-09-07 04:38:00
借用这里:它处理悬停问题,但是您应该能够修改这些原则来为您工作。这样,您就可以创建在分类法菜单项上处于活动状态的css。
When I hover over a div or class with an id of "a", can I get the background color of a div or class with the id of "b" to change?
Yes, you can do that, but only if #b is after #a in the HTML.
If #b comes immediately after #a: http://jsfiddle.net/u7tYE/
#a:hover + #b {
background: #ccc
}
<div id="a">Div A</div>
<div id="b">Div B</div>
That's using the adjacent sibling combinator (+).
If there are other elements between #a and #b, you can use this: http://jsfiddle.net/u7tYE/1/
#a:hover ~ #b {
background: #ccc
}
<div id="a">Div A</div>
<div>random other elements</div>
<div>random other elements</div>
<div>random other elements</div>
<div id="b">Div B</div>
That's using the general sibling combinator (~).
Both + and ~ work in all modern browsers and IE7+
If #b is a descendant of #a, you can simply use #a:hover #b.
ALTERNATIVE: You can use pure CSS to do this by positioning the second element before the first. The first div is first in markup, but positioned to the right or below the second. It will work as if it were a previous sibling.
发布于 2015-03-15 23:39:40
未来的读者可能对使用模块菜单_位置来控制活动轨迹感兴趣。
通常情况下,网站建设者希望某些类型的内容出现在导航菜单中的特定位置。最简单的解决方案是将所有这些内容单独添加到菜单系统中,它存在性能和可用性问题。(想象一下数百个菜单项添加到菜单中的一个位置。)该模块允许创建规则,这些规则将动态地将当前页面添加到请求点的菜单系统中。这包括影响:
https://drupal.stackexchange.com/questions/128660
复制相似问题