CSS导航菜单 - 水平并保持子菜单打开 [英] CSS Navigation Menu - horizontal and keep submenu opened

查看:73
本文介绍了CSS导航菜单 - 水平并保持子菜单打开的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这个代码用于在HTML页面上导航。这是一个手风琴风格的下拉菜单。一切正常我只需要更改它,以便submenuheader类允许它是一个可点击的链接。现在,例如Home所发生的一切都有关于我们和质量的两个子菜单。单击主页时,它会展开下拉列表。但是我希望它能够扩展并指向主页。提前谢谢!

展开 | 选择 | Wrap | 行号

解决方案

@Nyris


但是当它立即引导用户进入家时,为什么要扩展呢?网站没有机会去关于我们或质量?或反过来问,用户应该如何达到质量的目的。 (尽管他可能无法阅读,但该网站的名称是这样的。)


问候


主页已公布什么不重要。因此,一旦用户将他/她自己引导到另一个页面,除非您多次按下后退按钮,否则无法返回主页。


有一些方法

- 定义顶层链接unlickable(删除href属性),因此onclick将显示菜单。与此事件一起添加href属性,以便元素成为一个完整的工作链接元素。

- 使用2个onclick事件。第一个显示子菜单并将第二个事件添加到顶级元素(第二个事件从头开始不得出现)

- 使用CSS下拉菜单。在那里你根本不需要javascript(除了IE黑客)


我推荐最后一个选项。


问候

I have this code used for the navigation on an HTML page. It''s an accordion style dropdown menu. Everything works fine I just need to change it so that the submenuheader class allows it to be a clickable link. Right now all that happens with for example Home has two submenus of About Us and Quality. When you click home it expands the dropdown. But I want it to expand and also direct to a Home page. thanks in advance!


Expand|Select|Wrap|Line Numbers

解决方案

@Nyris
but why should it expand when it instantly leads the user to the "home" site without the chance to go to"About Us" or "Quality"? or asked the other way round, how is the user supposed to get to "quality" (despite the fact that he probably couldn''t read, that the site is named so).

regards


The home page has announcments and what not that are important. So once the user directs him/herself to a different page right now there''s no way to get back to the homepage unless you hit the back button however many times you need to.


there are some ways out
- define the top level links unclickable (removing the href attribute), so the onclick will show up the menu. along with this event add the href attribute, so that the element becomes a full working link element.
- use 2 onclick events. the first one to show up the submenu and adding the second event to the top level element (the second event must not be present from the start)
- use a CSS dropdown menu. there you don''t need javascript at all (except for the IE hacks)

I recommend the last option.

regards


这篇关于CSS导航菜单 - 水平并保持子菜单打开的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆