I have this menu that I customized to use it like a select. It work just fine on ie, chrome but on firefox is not working. Normal behavior is: when menu is expanded on focus the links are displayed (help and logoff) and if you click on them will be redirected in other page in the same browser. Wrong behavior on firefox: menu si expanded on focus but links (hep and logoff) are not redirecting.
<ul id="main">
<li class="username" tabindex="1" > <a>USER</a>
<ul class="curent_buser">
<li class="ai"><a class="jaximus"href="http://en.wikipedia.org/wiki/Wiki">Help</a></li>
<li class="aj"><a class="jaximus" href="http://en.wikipedia.org/wiki/Wiki" name="logoff">Log Off</a></li> </ul>
</li>
</ul>
Why is doing this firefox??? I have last version of ff :|
here is a fiddle example: http://jsfiddle.net/RwtHn/1152/
The href attribute specifies the URL of the page the link goes to. If the href attribute is not present, the <a> tag will not be a hyperlink.
The href attribute link (short for “Hypertext REFerence”) indicates the relationship between pages to search engines. href is an attribute of the anchor tag and contains two components: The URL (the actual link) and. The clickable text or object that users will see on the page (known as the “anchor text”)
The HTML <a> href Attribute is used to specify the URL of the page that the link goes to. When the href attribute is not present in the <a> an element that it will not be a hyperlink. This attribute is used to specify a link to any address.
It's because the instant you press down on either "Help" or "Log Off" the encompasing a element gets the focus and is active, which "deactivates" this rule:
#main li:focus ul, #main a:active + ul{
display:block;
}
Thus the link (or more specifically the ul encompassing the link) vanishes before the click on the link has been completed.
At least this seems to be how firefox handles it.
EDIT: It should work with adding the selector
#main li.username:active ul
to above rule.
Change your final rule to this:
#main li:focus ul, #main a:active + ul,
#main li ul:hover
{
display:block;
}
The #main li ul:hover
rule means that the submenu will stay open long enough for the click to register.
See forked JS Fiddle
p.s. Cool trick, I've never seen a select box launched like this before.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With