Joomla:如何在浏览单独的子菜单项时保持主菜单项突出显示?
我正在尝试制作一个水平的“类别”主菜单和一个与主菜单分开的垂直子菜单。当我选择一个类别时,会显示其主页。但是,当我从子菜单中选择另一个页面时,该页面应该来自同一类别,然后主菜单中的“类别”项将停止突出显示。所有菜单都定义为“独立”模块,我使用的是 Joomla 1.6.3。
I'm trying to make a horizontal, "category" main menu and a vertical submenu, separated from the main one. When I select a category its main page is displayed. But when I select another page from the submenu, that is supposed to be from the same category, then the "category" item from main menu stops being highlighted. All the menus are defined as a "stand-alone" modules and I'm using Joomla 1.6.3.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
任何类型的突出显示或效果都基于 CSS 类,这些类是在创建菜单时通过 XML 分配的。如果您将每个菜单分开而不是一个大的层次结构,您可能会遇到问题。您的菜单结构应使用层次结构在一个模块中制作。
如果我们查看 Joomla 1.6 演示页面:hhttp://demo16.cloudaccess.net/index.php/using-joomla/extensions 我们可以看到“Using Joomla!”是父级,“使用扩展是子级”。让我们看看分配给
使用 Joomla - class="active Deep Parent"
使用扩展 - class="当前活动的深层父级"
然后,您可以根据层次结构使用 CSS Javascript 控制格式,例如
例如,以下是该页面上使用的一些 CSS 规则:
如果您没有使用一个大菜单来处理所有内容,那么父项将不会添加正确的 CSS 类,您将不得不执行更复杂的 JavaScript。
Any type of highlighting or effect is based upon CSS classes which are assigned in the creation of the menu via XML. If you have each menu as separate instead of one large hierarchy you may run into problems. Your menu structure should be made in one module using hierarchy.
If we look at the Joomla 1.6 demo page at: hhttp://demo16.cloudaccess.net/index.php/using-joomla/extensions We can see that "Using Joomla!" is the parent and "Using Extensions is the child". Let's look at the CSS classes assigned to the
Using Joomla - class="active deeper parent"
Using Extensions - class="current active deeper parent"
You can then control formatting using CSS Javascript based upon the hierarchy like
For example here are some the CSS rules being used on that page:
If you are not using one large menu for everything, then the parent items will not have the correct CSS classes added and you will have to do more complex javascript.
当时我不知道的是,我应该将顶部菜单中的每个项目设置为菜单项别名。这使我能够在从子菜单中选择项目时保持该项目突出显示。
根据Joomla文档http://docs.joomla.org/Help16:Menus_Menu_Item_Manager_Edit#Menu_Item_Alias :
对于那些像我一样之前正在为 Joomla 菜单的想法而苦苦挣扎的人 - 这种配置中的主菜单位于“模块菜单”中,开始和结束级别设置为 1(基本选项),子菜单位于不同的“模块”中,但具有相同的菜单,但从级别 2 开始。
What I didn't know at the time was that I should set each item in the top menu as a Menu Item Alias. This allowed me to keep the item highlighted when items were selected from the submenu.
According to Joomla documentation http://docs.joomla.org/Help16:Menus_Menu_Item_Manager_Edit#Menu_Item_Alias:
For those who, like me before, are struggling with the idea of Joomla menus - the main menu in such configuration sits in a "Module Menu" with Start and End Level set to 1 (Basic Options), and the submenu sits in a different "Module", but carries the same menu, buts starts from Level 2.